On Mar 7, 9:33 am, [EMAIL PROTECTED] wrote: > On Mar 7, 9:12 am, nodrogbrown <[EMAIL PROTECTED]> wrote: > > > > > hi > > i am using python on WinXP..i have a string 'folder ' that i want to > > join to a set of imagefile names to create complete qualified names so > > that i can create objects out of them > > > folder='F:/brown/code/python/fgrp1' > > filenms=['amber1.jpg', 'amber3.jpg', 'amy1.jpg', 'amy2.jpg'] > > filenameslist=[] > > for x in filenms: > > myfile=join(folder,x) > > filenameslist.append(myfile) > > > now when i print the filenameslist i find that it looks like > > > ['F:/brown/code/python/fgrp1\\amber1.jpg', > > 'F:/brown/code/python/fgrp1\\amber3.jpg', 'F:/brown/code/python/fgrp1\ > > \amy1.jpg', 'F:/brown/code/python/fgrp1\\amy2.jpg'] > > > is there some problem with the way i use join? why do i get \\ infront > > of the basename? > > i would prefer it like 'F:/brown/code/python/fgrp1/basename.jpg', > > > can anyone pls help > > gordon > > see path.join in the os library.
Upon further examination... it looks like you are using windows and os.path.join. The separator for windows is a '\'. In python, you have to escape that character with another '\'. That's why you see '\\'. That being said, I think what you have will still work to access a file. Windows is usually smart enough to deal with a front slash here and there. -- http://mail.python.org/mailman/listinfo/python-list