simple string formatting question

Neal Becker ndbecker2 at gmail.com
Fri Dec 14 10:29:59 EST 2007


I have a list of strings (sys.argv actually).  I want to print them as a
space-delimited string (actually, the same way they went into the command
line, so I can cut and paste)

So if I run my program like:
./my_prog a b c d

I want it to print:

'./my_prog' 'a' 'b' 'c' 'd'

Just print sys.argv will almost work, but it's comma-delimited.

There must be some clever way to do this.  Any ideas?




More information about the Python-list mailing list