which is the right file path format in python3.4 ?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sun Dec 14 06:03:45 EST 2014
sir wrote:
> 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'
Are you sure that you have an F drive?
Is it a writable disk? e.g. a hard drive, not a CD drive.
Do you have read and write permissions to F drive?
Run this code and show us what it prints:
import os
print(os.stat("F:\\")
print(os.access("F:\\", os.O_RDWR))
--
Steven
More information about the Python-list
mailing list