Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #82495

which is the right file path format in python3.4 ?

Date 2014-12-14 17:05 +0800
From sir <elearn2014@gmail.com>
Subject which is the right file path format in python3.4 ?
Newsgroups comp.lang.python
Message-ID <mailman.16941.1418547951.18130.python-list@python.org> (permalink)

Show all headers | View raw


My system is :win7+python3.4  .

I want to write a new file "named names.txt"  in disk f:

  >>> ff=open(r"F:\names.txt","w")
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument: 'F:\\names.txt'
 >>> ff=open(r"F:/names.txt","w")
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument: 'F:/names.txt'
 >>> ff=open(r"F://names.txt","w")
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument: 'F://names.txt'
 >>> ff=open(r"f://names.txt","w")
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument: 'f://names.txt'
 >>> ff=open(r"f:/names.txt","w")
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument: 'f:/names.txt'

which is the right  file path format in python3.4 ?

Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

which is the right  file path format in python3.4 ? sir <elearn2014@gmail.com> - 2014-12-14 17:05 +0800
  Re: which is the right  file path format in python3.4 ? Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2014-12-14 10:52 +0100
  Re: which is the right  file path format in python3.4 ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-12-14 22:03 +1100
    Re: which is the right file path format in python3.4 ? Chris Angelico <rosuav@gmail.com> - 2014-12-14 22:09 +1100
      Re: which is the right file path format in python3.4 ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-12-14 22:51 +1100
        Re: which is the right file path format in python3.4 ? Chris Angelico <rosuav@gmail.com> - 2014-12-14 23:13 +1100

csiph-web