Dynamic File Name Open()

Robert Rawlins - Think Blue robert.rawlins at thinkbluemedia.co.uk
Wed May 2 01:43:31 EDT 2007


Chaps,

 

I'm trying to open a file using open() but the name of the file is created
dynamically as a variable, but also has part of a static path. For instance,
the file may be called 'dave' and will always be in '/my/files/here/'.

 

Now I've tried a few combinations of getting this to work, such as.

 

Path = '/my/files/here/%s' % (name)

 

Open(Path, 'r')

 

But that does work, can anyone enlighten me on the best way to do this?

 

Thanks,

 

Rob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070502/c2568c5e/attachment.html>


More information about the Python-list mailing list