28 - Command Line Arguments ( sys.argv ) | Python Tutorials

Поделиться
HTML-код
  • Опубликовано: 2 окт 2024

Комментарии • 12

  • @dimitriosdesmos4699
    @dimitriosdesmos4699 6 лет назад +8

    After i get the basics from other videos i come here for really cool stuff that i cant get elswhere, but if you think for one second that a newbie will understand anything that you say think again.
    You go into sys...like....what is SYS??....no introduction whatsoever. .....

  • @hansmaier4119
    @hansmaier4119 Год назад

    I only had to watch 25 videos before I found yours. Now I understand how sys.argv. Thanks a million

  • @codingspace1143
    @codingspace1143 6 лет назад +3

    Nice explanation really ...but how I can passed arguments between two python scripts in my network? Thanks

  • @sufiyanmomin443
    @sufiyanmomin443 5 лет назад +2

    How to set default command line argument

  • @faiqahmadkhan6009
    @faiqahmadkhan6009 4 года назад +1

    It was really helpful . thank you, can you please tell how to pas arguments in a loop or in array form. actually i have 300 files and want to pass them as arguments.

    • @SimplyCoded
      @SimplyCoded  4 года назад

      They’re passed just like any other argument.
      Without seeing your code I’m not sure what you’re struggling with in particular.
      MyFunc(myFileList)
      def MyFunc(fileList):
      for file in fileList:
      #deal with file

  • @mr.anderson5393
    @mr.anderson5393 4 года назад +2

    When would you use this?

    • @SimplyCoded
      @SimplyCoded  4 года назад

      Anytime you want to start a script with specific options. I’m guessing you’ve never used a command line utility, but the gist of it is: Your script is either made to do multiple related things and depending on which option “command line arg” you pass in will change the scripts behavior, and or as the programmer you try to make your script as generic as possible so that the user can pass in the details at the start of the script thus making it more flexible without having the user know how to code.

    • @mr.anderson5393
      @mr.anderson5393 4 года назад

      @@SimplyCoded I did it before, just that I forgot the syntax I guess. After watching your video, it came back. Thanks for the video.

  • @rohankarra6191
    @rohankarra6191 6 лет назад +1

    Im a better snake than u

  • @brandonlee712
    @brandonlee712 5 лет назад +2

    Why not just use input()

    • @TalsonHacks
      @TalsonHacks 4 года назад

      Brandon Lee cuz Input is limited, but argv can be used to add as many arguments as you like