Noobie Question: Using strings and paths in mkdir (os.mkdir("/test/"a))

Roman Neuhauser neuhauser+python-list#python.org at sigpipe.cz
Fri Apr 22 03:30:20 EDT 2005


# smacpher at gmail.com / 2005-04-22 00:13:05 -0700:
> Hello!
> 
> I can't seem to get paths and variables working together:
> 
> import os
> a = 'books'
> os.chdir( '/test')
> os.mkdir("/test/"a)
> 
> the last line does not seem to work.  os.mkdir(a) makes the directory
> books, but i want this directory as a subdirectory of test.
> 
> I also tried: os.mkdir("/test/",a), and trying to make b = 'test' and
> then os.mkdir(a b).
> 
> Does someone have any ideas or a link they can give me, I looked under
> strings in the python tutorial and library manual but I guess not in
> the right spot.

    http://docs.python.org/ref/string-catenation.html

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991



More information about the Python-list mailing list