728x90
    
    
    
  import sys
print(sys.argv[0]) # PythonTest_01.py
print(sys.argv[1]) # aaaa
print(sys.argv[2]) # bbbb
print(sys.argv[3]) # cccc
print(sys.argv[4]) # dddd
실행 시 python 파일명.py aaaa bbbb cccc dddd
인자로 받은 argv는 모두 str 이므로 형변환 필요한 경우 해야함.
728x90
    
    
    
  'Python' 카테고리의 다른 글
| python if 한줄코딩 (0) | 2021.01.26 | 
|---|---|
| pyupbit nonetype error (0) | 2021.01.26 | 
| inconsistent use of tabs and spaces in indentation (0) | 2021.01.26 | 
| python 암호화폐 자동매매 참고 사이트 (0) | 2021.01.26 | 
| python dictionary to string (0) | 2021.01.25 |