command line arguments PYTHON -


code

import sys  def main()     print(sys.argv) 

version - 3.3

file name pytest.py

running file syntax pytest.py aaa bbb ccc

but didn't print , not giving error also

you never call main().

python has no special main function run automatically, instead, can place code want run when file called command line special if block:

import sys  def main():     print(sys.argv)  if __name__ == '__main__':     main() 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -