Randy Kreuziger wrote: > Thanks for the basename suggestion. That almost works. I'm running > into a problem with some of the directory names when they include > \800x\ see below. > �----------------------------------------------------------------------------- > import sys, os, string > > teststring = 'C:\shoreline\dvd\prep area\800x\060623_00001.jpg' > print os.path.basename(teststring) > �----------------------------------------------------------------------------- > Results in > 800x0623_00001.jpg > > But it needs to be > 060623_00001.jpg > You need to be careful with those backslashes!
>>> teststring = 'C:\shoreline\dvd\prep area\800x\060623_00001.jpg' >>> teststring 'C:\\shoreline\\dvd\\prep area\\800x0623_00001.jpg' >>> teststring = r'C:\shoreline\dvd\prep area\800x\060623_00001.jpg' >>> teststring 'C:\\shoreline\\dvd\\prep area\\800x\\060623_00001.jpg' >>> regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden --------------- Asciimercial ------------------ Get on the web: Blog, lens and tag the Internet Many services currently offer free registration ----------- Thank You for Reading ------------- -- http://mail.python.org/mailman/listinfo/python-list