简体   繁体   中英

Error while trying to open CSV file in python

Python rookie here. Trying to use the CSV module, but I get an error:

IOError: [Errno 2] No such file or directory: 'books.csv'

The actual CSV file is stored on my desktop. I suppose this means Python can't find the file? If so, how can I fix this?

Many thanks in advance!

Since your file name includes no path component, it is implicitly assigned to be in the current directory. Unless your current directory is the desktop, you won't be able to find the file.

Either give it a full pathname, or move to the desktop and run your script from there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM