Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Converting argv to variable
July 22, 2006, 1:49 am
rate this thread
into utterly stumped me. Been too long and none of the searches I've
done seems to have helped any.
Basically, I'm trying to create a little script which will make a new
directory, using the argument passed to it to give the directory a
import sys, os
newDirectory = str(sys.argv[1:])
currentPath = str(os.getcwd())
create = currentPath + '/' + newDirectory
Now, in a perfect universe I would get an output something like the
following (if I run the script with the argument 'python':
However, Python still hangs on to all the fluff and prints out
I know there must be some way to convert the argument to a 'normal'
variable, but it escapes me how to do so. Any pointers?