Python Forum
Taking Multiple Command Line Argument Input
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Taking Multiple Command Line Argument Input
#6
(Mar-29-2020, 05:16 PM)jefsummers Wrote: Try this
import sys

argument_list = sys.argv
how_many = len(argument_list)

print(f'You entered {how_many} arguments')
print('They are')
for passed in argument_list :
    print(f'{passed}')
Output:
C:\Users\Jeff\foo>python arguments.py 45 28 16 1000 2 hello world You entered 8 arguments They are arguments.py 45 Thank you very much! You are the best it helped a lot. 28 16 1000 2 hello world
Thank you very much! You are the best it helped a lot.
Reply


Messages In This Thread
RE: Taking Multiple Command Line Argument Input - by bwdu - Mar-29-2020, 05:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Receive Input on Same Line? johnywhy 8 736 Jan-16-2024, 03:45 AM
Last Post: johnywhy
  __init__() got multiple values for argument 'schema' dawid294 4 2,410 Jan-03-2024, 09:42 AM
Last Post: buran
  problem in using input command akbarza 4 1,154 Oct-19-2023, 03:27 PM
Last Post: popejose
Information How to take url in telegram bot user input and put it as an argument in a function? askfriends 0 1,109 Dec-25-2022, 03:00 PM
Last Post: askfriends
  Trying to loop through code to plot seaborn line plots across multiple subplots eyavuz21 0 1,696 Dec-05-2022, 10:46 AM
Last Post: eyavuz21
  Command line argument issue space issue mg24 5 1,353 Oct-26-2022, 11:05 PM
Last Post: Yoriz
  accept command line argument mg24 5 1,350 Sep-27-2022, 05:58 PM
Last Post: snippsat
  Substitue multiple substrings in one command Pavel_47 0 842 Jul-18-2022, 01:24 PM
Last Post: Pavel_47
Lightbulb Multiple inputs on the same line (beginner) dementshuk 9 2,830 Sep-03-2021, 02:21 PM
Last Post: dementshuk
  Accessing varying command line arguements Rakshan 3 2,066 Jul-28-2021, 03:18 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020