Really, really annoying problem

Brett Lempereur a.lempereur
Wed Sep 20 14:57:20 EDT 2000


Right, well for a start so I don't get everybody on my back again, here's
the code I'm using...

def addroot(text):
    # Definitions
    new_string = ""
    arg = sys.argv[0]
    split_arg = string.split(arg, '\\')
    # Cycle through
    for count in range(0, len(split_arg) - 1):
        new_string = new_string + split_arg[count] + "\\"        # THIS IS
THE PROBLEM
    new_string = new_string + text
    # Return the reconstructed string
    return new_string

The function of this code is to append a filename to the directory the
module is in, I'll add more functionality later, but for the minute this
will do.

Anyway, it does exactly what i want, but unexplainably, instead of inserting
the one "\" like it should, it inserts "\\" .  I can't figure why this is
hapenning. and would appreciate anybodies help

thanks




More information about the Python-list mailing list