为了账号安全,请及时绑定邮箱和手机立即绑定

sys.argv[1]在脚本中的意义

sys.argv[1]在脚本中的意义

喵喵时光机 2019-07-04 13:33:10
sys.argv[1]在脚本中的意义我目前正在教自己Python,只是想知道(参考下面的例子)用简单的术语来说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()
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 2667 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信