On 08/17/2010 05:46 PM, Grant Edwards wrote: > On 2010-08-17, Neil Cerutti <ne...@norwich.edu> wrote: >> On 2010-08-17, Stefan Schwarzer <sschwar...@sschwarzer.net> wrote: >>> Hi Alex, >>> >>> On 2010-08-16 18:44, Alex van der Spek wrote: >>>> Anybody catches any other ways to improve my program (attached), you are >>>> most welcome. Help me learn, that is one of the objectives of this >>>> newsgroup, right? Or is it all about exchanging the next to impossible >>>> solution to the never to happen unreal world problems? >>> >>> I don't know what a concordance table is, and I haven't >>> looked a lot into your program, but anyway here are some >>> things I noticed at a glance: >>> >>> | #! usr/bin/env python >>> | # Merge log files to autolog file >>> | import os >>> | import fileinput >>> | #top='C:\\Documents and Settings\\avanderspek\\My >>> Documents\\CiDRAdata\\Syncrude\\CSL\\August2010' >>> | top='C:\\Users\\ZDoor\\Documents\\CiDRA\\Syncrude\CSL\\August2010' >>> >>> If you have backslashes in strings, you might want to use "raw >>> strings". Instead of "c:\\Users\\ZDoor" you'd write >>> r"c:\Users\ZDoor" (notice the r in front of the string). >> >> That's good general advice. But in the specific case of file >> paths, using '/' as the separator is supported, and somewhat >> preferable. > > Unless you're going to be passing them to cmd.exe or other utilities > via subprocess/popen. > in that case you could use os.path.normpath() prior to passing it to an external program und use slashies internally.
A little less performant, but in my opinion nicer typing. -- http://mail.python.org/mailman/listinfo/python-list