Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with script
#2
sys.argv is a way to get command line arguments into python.
ex13.py 1 2 3 should do it.
Test:
λ python foo.py 1 2 3
The script is called: foo.py
The first variable is: 1
The second variable is: 2
The third variable is: 3
Or string:
λ python foo.py hello world car
The script is called: foo.py
The first variable is: hello
The second variable is: world
The third variable is: car
sys.argv is the simplest version of this,argparse is in standard library.
There also many 3-part librarians for this Click(my favorite),Dotcop,Fire ect...
Reply


Messages In This Thread
Help with script - by oldDog - May-22-2018, 07:40 PM
RE: Help with script - by snippsat - May-22-2018, 08:25 PM
RE: Help with script - by oldDog - May-29-2018, 11:06 AM

Forum Jump:

User Panel Messages

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