![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Jul 2005
Posts: 62
Rep Power: 4
![]() |
open()
Well, I'm learning python. I'm using my windows PC for it.
Now, here's what I'm putting in and the result: >>> f=open('M:\programming\read.txt','r+')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
IOError: [Errno 2] No such file or directory: 'M:\\programming\read.txt'
>>>I know that the file and location is right, I'm just not sure if I'm putting it in right. Thanks for any help. |
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4
![]() |
'M:\\programming\read.txt'
you missed a backslash before read.txt |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Jul 2005
Posts: 62
Rep Power: 4
![]() |
Thank you very much, working beautifully now.
|
|
|
|
|
|
#4 | |
|
Programmer
Join Date: Apr 2005
Posts: 73
Rep Power: 4
![]() |
Quote:
f=open(r'M:\programming\read.txt','r+') import os
fname = os.path.join("M:\\", "whereever", "foo.txt")
f=open(fname, "r+")--OH. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|