Is there any way to execute single part of my python script on command line Like output.py —u for user interface part And output.py —f for ftp part
Asked
Active
Viewed 10 times
0
-
Have you checked https://stackoverflow.com/questions/1009860/how-to-read-process-command-line-arguments ? – benjamintemitope Jul 05 '22 at 20:47
1 Answers
0
You can check for flags with this code: '-d' in sys.arg
Full code example:
import sys
if('-u' in sys.argv):
# run user code part
print('user part')
elif('-f' in sys.argv):
# ftp part
print(' ftp part')

Hossein hossein
- 147
- 4