Noobie Question: Using strings and paths in mkdir (os.mkdir("/test/"a))
Simon Brunning
simon.brunning at gmail.com
Fri Apr 22 04:55:12 EDT 2005
On 4/22/05, Roman Neuhauser <neuhauser+python-list#python.org at sigpipe.cz> wrote:
> > 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.
> http://docs.python.org/ref/string-catenation.html
For this job, os.path.join() might be better. See
<http://docs.python.org/lib/module-os.path.html>.
--
Cheers,
Simon B,
simon at brunningonline.net,
http://www.brunningonline.net/simon/blog/
More information about the Python-list
mailing list