windows file names in Python

B

beliavsky

I know to use "\\" as the separator in Windows file names to get them
recognized in Python. Is there a way to get "\" recognized as a
directory separator?
 
R

r.e.s.

I know to use "\\" as the separator in Windows file names to get them
recognized in Python. Is there a way to get "\" recognized as a
directory separator?

Like this, for example? ...

fpath = r'C:\Documents and Settings\res\test.txt'
f = open(fpath,'wb')

--r.e.s.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,966
Members
47,515
Latest member
Harvey7327

Latest Threads

Top