Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python get arguments

import argparse

parser = argparse.ArgumentParser()
parser.add_argument('-d', '--date', help='date of event', type=str)
parser.add_argument('-t', '--time', help='time of event', type=str)
args = parser.parse_args()

print(f'Event was on {args.date} at {args.time}')
Comment

python read arguments

#!/usr/bin/python

import sys

print('Number of arguments:', len(sys.argv), 'arguments.')
print('Argument List:', str(sys.argv))
Comment

PREVIOUS NEXT
Code Example
Python :: You did not provide the "FLASK_APP" environment variable 
Python :: system commands in python windwos 
Python :: reset index with pandas 
Python :: dataframe to dictionary without index 
Python :: fastest sort python 
Python :: pyhton turtle kill 
Python :: extend stack python 
Python :: python exceute 60 records per minute counter 
Python :: how to construct simple timedelta in python 
Python :: chi square test in python 
Python :: char list to string python 
Python :: read_csv unnamed zero 
Python :: import pyttsx3 
Python :: get gpu name tensorflow and pytorch 
Python :: convert categorical column to int in pandas 
Python :: colab kaggle dataset 
Python :: django all urls 
Python :: rename columns in dataframe 
Python :: nb_occurence in list python 
Python :: tkinter gui grid and frame 
Python :: plot bounds python 
Python :: find nan value in dataframe python 
Python :: powershell get list of groups and members 
Python :: python print string separated by comma 
Python :: Entry border color in tkinter 
Python :: python check if input is between two values 
Python :: python link to jpg 
Python :: list of strings to numbers python 
Python :: pyperclip copy paste 
Python :: selenium python 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =