当前位置:网站首页>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
边栏推荐
- Classification of technology selection (2022)
- mysql function函数语法
- Plug in for vscode
- Depth deterministic strategy gradient (ddpg)
- Source code and some understanding of employee management system based on polymorphism
- JZ22 链表中倒数最后k个结点
- 进阶上将程序员必备素质
- PDH optical transceiver 4-way E1 + 4-way 100M Ethernet 4-way 2m optical transceiver FC single fiber 20km rack type
- Winsock programming interface experiment: Ping
- Winsock programming interface experiment: implementation of ipconfig
猜你喜欢

Airtrack cracking wireless network password (Dictionary running method)

【Hcip】OSPF常用的6种LSA详解

Liunx foundation - zabbix5 0 monitoring system installation and deployment

ele之Table表格的封装

工业互联网+危化安全生产综合管理平台怎样建

First knowledge of C language ~ branch statements

Kubernetes - Introduction to actual combat

Sonic cloud real machine tutorial

Encapsulate components such as pull-down menu based on ele

LeetCode 1450 - 1453
随机推荐
Actual combat of industrial defect detection project (IV) -- ceramic defect detection based on hrnet
Source code and some understanding of employee management system based on polymorphism
Close the computer port
Practical combat of industrial defect detection project (II) -- steel surface defect detection based on deep learning framework yolov5
Devil cold rice 𞓜 078 devil answers the market in Shanghai and Nanjing; Communication and guidance; Winning the country and killing and screening; The purpose of making money; Change other people's op
Opencv fills the rectangle with a transparent color
Centos7 install MySQL 8 0
Shell script learning -- practical case
windows MySQL8 zip安装
Face longitude:
Numpy append function
tf. keras. layers. Inputlayer function
基于Scrum进行创新和管理
Q-Learning & Sarsa
Win view port occupation command line
Table space capacity query and expansion of Oracle Database
OCR recognition PDF file
JS learning notes
OCR识别PDF文件
Innovation and management based on Scrum