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

S

Shaun

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
 
R

Roman Neuhauser

# (e-mail address removed) / 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top