I would like to specify a file for manipulation from the command line. I am new to python so I'm not really sure how to begin this. I am guessing that I need some options?
sniperx99 0 Newbie Poster
Recommended Answers
Jump to PostGood answer but permit me to suggest a minor change to the above example.
#!/usr/bin/env python #argecho.py import sys if sys.argv: print "The name of this program is:",sys.argv[0] print "The first command line argument I received is:",sys.argv[1] print "The second command line argument I received is:",sys.argv[2]
All 4 Replies
lllllIllIlllI 178 Veteran Poster
d5e5 109 Master Poster
lllllIllIlllI commented: Woops :) my bad. Nicely done +2
sniperx99 0 Newbie Poster
d5e5 109 Master Poster
vegaseat commented: nice +10
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.