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

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

Post by smacphe » Sat, 23 Apr 2005 16:13:05


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.

Thanks for your help!

Shaun
 
 
 

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

Post by Roman Neuh » Sat, 23 Apr 2005 16:30:20

# XXXX@XXXXX.COM / 2005-04-22 00:13:05 -0700:

http://www.yqcomputer.com/

--
How many Vietnam vets does it take to *** in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://www.yqcomputer.com/

 
 
 

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

Post by Simon Brun » Sat, 23 Apr 2005 17:55:12


For this job, os.path.join() might be better. See
< http://www.yqcomputer.com/ ;.

--
Cheers,
Simon B,
XXXX@XXXXX.COM ,
http://www.yqcomputer.com/