471,330 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

usage of file separator

in my code i am iterating thru a list of filenames (like 'image1.jpg'
etc) and appending them to fully qualified directory names

for x in imagefilenames:
imgfile=folder+"/"+x
newimgfilenamelist.append(imgfile)

sothat finally i can get items like c:/mycode/image1.jpg etc from the
newimgfilenamelist

on windows this will work..but how do i make it work on other os?
Being a beginner i couldn't figure out how to solve this using
os.path can anyone help?

sorry if this is a silly qn
dn
Dec 31 '07 #1
2 3901
de****@gmail.com:
for x in imagefilenames:
imgfile=folder+"/"+x
newimgfilenamelist.append(imgfile)

[..] how do i make it work on other os?
from os.path import join
#..
imgfile=join(folder, x)

--
Thomas Wittek
Web: http://gedankenkonstrukt.de/
Jabber: st*********@jabber.i-pobox.net
GPG: 0xF534E231
Dec 31 '07 #2
>
from os.path import join
#..
* * imgfile=join(folder, x)

--
Thomas Wittek
thanx!
dn
Jan 1 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by chris | last post: by
4 posts views Thread by Hal Vaughan | last post: by
2 posts views Thread by Ben Enfield | last post: by
12 posts views Thread by oksuresh | last post: by
29 posts views Thread by Markus Pitha | last post: by
7 posts views Thread by JB | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.