RE: Maintaining leading zeros with the lstrip string function?
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_1.jpg' print os.path.basename(teststring) ―- Results in 800x0623_1.jpg But it needs to be 060623_1.jpg -- http://mail.python.org/mailman/listinfo/python-list
Maintaining leading zeros with the lstrip string function?
I need just the file name from a string containing the path to a file. The name of the file starts with zeros. This is problematic because the lstrip function strips them leaving this as the result: 6128.jpg How do I strip the path without losing the leading zeros in the file name? ―- import sys, os, win32com.client, string teststring = 'C:\shoreline\dvd\prep area\800x\\006128.jpg' print string.lstrip(teststring, 'C:\shoreline\dvd\prep area\800x\\') -- http://mail.python.org/mailman/listinfo/python-list
Executing a DOS program from within Python
This is probably a newbie question but I need a kick start to get going. I need to run a DOS (sdetable) program from within a Python program. I'll use command line switches so I will not need to interact with the program however it would be nice if I could capture its exit code. Thanks Randy Kreuziger (360) 902-2495 Voice (360) 902-2940 Fax ArcSDE Administrator Wash Dept of Fish and Wildlife -- http://mail.python.org/mailman/listinfo/python-list
Redirecting both stdout and stderr to the same file
Can stdout and stderr be redirected to the same file? I would like to redirect both to the same file but I'm not sure how to do it. Currenting I'm redirectiong stdout using the following code: saveout = sys.stdout fsock = open('runtime.log', 'w') sys.stdout = fsock The problem is that when en error occurs that my program was not written to handle that error message is being sent to the cmd window and not my log file. My program may simply need to be more robust however I'm still a python novice. Thanks -- http://mail.python.org/mailman/listinfo/python-list