[Tutor] A question on tkFileDialog's askopenfilename

Glen Wheeler wheelege@tsn.cc
Thu, 30 Aug 2001 13:02:24 +1000


> <..>
> >
> > Also I found out that:
> > On Windows OS, askopenfilename() returns
> > c:/py/something.txt    instead of
> > c:\py\something.txt
> > (The \ become /)
> > Why?
>
> The / character is the standard path-separator on Unix, and most
> programming languages are therefore designed to recognize / as the path
> separator and use it by default. You can call the os.path.normpath()
> function to change / to \ if you want:
>

  Just to chip in here - if it was \ then the characters would be
interpreted as escape codes, as you no doubt found out if you tried to use
\'s instead of /'s.  Windows is a little sneaky and will actually accept
both :)

  Glen.