sys.argv[1]在脚本中的意义
sys.argv[1]
#!/usr/bin/python3.1# import modules used here -- sys is a very standard oneimport sys# Gather our code in a main() functiondef main(): print ('Hello there', sys.argv[1]) # Command line args are in sys.argv[1], sys.argv[2] .. # sys.argv[0] is the script name itself and can be ignored# Standard boilerplate to call the main() function to begin# the program.if __name__ == '__main__': main()
相关分类