Just use the length of sys.argv
if len(sys.argv) == 2:
# do X
else:
# do Y
More Related Contents:
- Python “int is not subscriptable” error
- What are metaclasses in Python?
- How to hide output of subprocess
- Explanation of how nested list comprehension works?
- Why does Python code run faster in a function?
- How to get string objects instead of Unicode from JSON?
- Weighted random selection with and without replacement
- Post-install script with Python setuptools
- How to split a dos path into its components in Python
- How to get indices of a sorted array in Python
- Does SQLAlchemy have an equivalent of Django’s get_or_create?
- How to print a generator expression?
- How to use cookies in Python Requests
- Using break in a list comprehension
- Python string.strip stripping too many characters [duplicate]
- Running Python code in Vim
- Django: How to manage development and production settings?
- Why isn’t assigning to an empty list (e.g. [] = “”) an error?
- Multiple parameters in Flask approute
- How to generate suffix trees using a python library? [closed]
- FastAPI UploadFile is slow compared to Flask
- Disable hash randomization from within python program
- Tkinter Show splash screen and hide main screen until __init__ has finished
- How to load .ttf file in matplotlib using mpl.rcParams?
- creating a MIME email template with images to send with python / django
- How can I make my Sprite launch an object towards the mouse position?
- sys.stdin.readline() and input(): which one is faster when reading lines of input, and why?
- Calculate RGB value for a range of values to create heat map
- Webdriver Screenshot
- Pandas data frame to dictionary of lists