coding problem, help needed

Andreas Jung andreas at andreas-jung.com
Sun Sep 3 14:46:34 EDT 2000


Guy Van Rentergem <guy.van.rentergem at skynet.be> wrote:
2qy
2qyHello people,
2qy
2qyI'm fairly new to python and I need help with this problem.
2qy
2qyI have a function which is reading a comma seperated string from a data
2qyfile:
2qy
2qyc:\windows\desktop\terrain.ter,-10.0,-60.0,25.0,128.0,0.0,0.0,0.0,0.0,0.0
2qy
2qy... open file then the code which gives problems
2qy
2qyline=inffile.readline()
2qyL1=string.split(line,',')
2qypath=L1[0]
2qyvalue1=L2[1]
2qy
2qy.....
2qy
2qyThe values are ok but path is something like 'c:\\w'
2qy
2qyWhat is going wrong?

Nothing :-) Because '\' acts as escape character the representation
for a backslash ist \\.  When you iterate byte by byte through path
you will see that there is really only one \ for every \ in the 
original string.

Cheers,
Andreas



More information about the Python-list mailing list