[Tutor] A question on tkFileDialog's askopenfilename

HY pythonpython@hotmail.com
Wed, 29 Aug 2001 23:10:17 +0900


Hi there,

I want to use tkFileDialog's askopenfilename to let user to choose a file. I
want to print the file path,and then I want to open file.
Say, the file a user wants to open is c:\py\something.txt
I know:
#------------------------------------
from tkFileDialog import askopenfilename
filePath=askopenfilename()
print "This is the file you chose",filePath
#------------------------------------

BUT how can use filePath to open the actual file?

Also I found out that:
On Windows OS, askopenfilename() returns
c:/py/something.txt    instead of
c:\py\something.txt
(The \ become /)
Why?

Thanks for your help.

HY