当前位置:网站首页>FileNotFoundError: [Errno 2] No such file or directory
FileNotFoundError: [Errno 2] No such file or directory
2022-04-23 02:58:00 【Siege lion Jason】
Problem description
Recently, with Python solve Euler plan question 13 when , Always report an error when opening a file
FileNotFoundError: [Errno 2] No such file or directory: '/ProjectEuler/data/013.txt'
map(int,open('data/013.txt'))
Later I checked , The discovery is related to the editor , involves work area The concept of , The solution is given below
Solution
First of all, let's show you my workspace ,Vscode
The editor parses the entire open folder as a workspace
What does that mean ? That is to say , The default working area of the editor here is algorithms
This entire folder , The file location distribution is like this
algorithms
|__ProjectEuler
|__data
| |__013.txt
|__013.py
If we want the program to correctly identify the file location , The path should be changed to Relative workspace The path of , namely :
map(int,open('ProjectEuler/data/013.txt'))
At this point, execute the code again , There will be no error
Reference material :
版权声明
本文为[Siege lion Jason]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220644066115.html
边栏推荐
- Introduction to ACM [inclusion exclusion theorem]
- 《信息系统项目管理师总结》第五章 项目质量管理
- It turns out that PID was born in the struggle between Lao wangtou and Lao sky
- BLDC double closed loop (speed PI + current PI) Simulink simulation model
- Les derniers noeuds K de la liste jz22
- Linux redis - redis database caching service
- Get together to watch (detailed version) eat a few cents a day
- What is the difference between varchar and char?
- JSON data text
- 字符串去掉空格问题
猜你喜欢
Traversal of l2-006 tree (middle and later order determination binary tree & sequence traversal)
Solve the problem that PowerShell mining occupies 100% of cpu7 in win7
Shell script learning notes - regular expressions
Linux Redis——Redis 数据库缓存服务
tf. keras. layers. Embedding function
How can enterprises with major hazard installations ensure the completion of the digital construction task of double prevention mechanism by the end of the year
Slave should be able to synchronize with the master in tests/integration/replication-psync. tcl
Machine learning (Zhou Zhihua) Chapter 14 probability graph model
Kubernetes - Introduction to actual combat
Log cutting - build a remote log collection server
随机推荐
Opencv fills the rectangle with a transparent color
《信息系统项目管理师总结》第七章 项目沟通管理
The input of El input input box is invalid, and error in data(): "referenceerror: El is not defined“
JDBC JDBC
Kubernetes - detailed explanation of pod
B blocks of the 46th ICPC Asian regional competition (Kunming)
The problem of removing spaces from strings
Winsock programming interface experiment: implementation of ipconfig
Practical combat of industrial defect detection project (II) -- steel surface defect detection based on deep learning framework yolov5
Android high-level interview must ask: overall business and project architecture design and reconstruction
leangoo脑图-共享式多人协作思维导图工具分享
Shell learning notes -- shell processing of output stream awk
Kubernetes - Introduction to actual combat
BLDC double closed loop (speed PI + current PI) Simulink simulation model
Redis data server / database / cache (2022)
What is the difference between varchar and char?
基于多态的职工管理系统源码与一些理解
Plug in for vscode
Publish to NPM?
JZ35 复杂链表的复制