Python Forum
How to iterate over command line arguments?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to iterate over command line arguments?
#3
(Nov-20-2018, 03:20 AM)ichabod801 Wrote: How does it not work? It works for me, although note that looping over a string loops over each character in the string. You did import sys, right? It's not in your code.

Here is what I got for output. How do I print each individual argument?

Output:
im-datestamp.py aaa bbb Number of arguments: 3 arguments. Argument List: ['./im-datestamp.py', 'aaa', 'bbb'] [ ' . / i m - d a t e s t a m p . p y ' , ' a a a ' , ' b b b ' ]
Reply


Messages In This Thread
RE: How to iterate over command line arguments? - by zBernie - Nov-20-2018, 03:55 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using subprocess to execute complex command with many arguments medatib531 5 1,976 Apr-27-2023, 02:23 PM
Last Post: medatib531
  Command line argument issue space issue mg24 5 1,388 Oct-26-2022, 11:05 PM
Last Post: Yoriz
  accept command line argument mg24 5 1,389 Sep-27-2022, 05:58 PM
Last Post: snippsat
  Accessing varying command line arguements Rakshan 3 2,096 Jul-28-2021, 03:18 PM
Last Post: snippsat
  How to input & output parameters from command line argument shantanu97 1 2,615 Apr-13-2021, 02:12 PM
Last Post: Larz60+
  Passing List of Objects in Command Line Python usman 7 3,264 Sep-27-2020, 03:45 PM
Last Post: ndc85430
  Taking Multiple Command Line Argument Input bwdu 6 4,109 Mar-29-2020, 05:52 PM
Last Post: buran
  python 3 from command line Dixon 1 2,057 Mar-01-2020, 08:35 PM
Last Post: snippsat
  execute linux command with arguments sivareddy 2 2,290 Feb-10-2020, 03:23 PM
Last Post: sivareddy
  Running linux command line apps... dbrdh 0 1,688 Jan-30-2020, 01:14 PM
Last Post: dbrdh

Forum Jump:

User Panel Messages

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