selfteaching / selfteaching/selfteaching-python-camp

Day09 with open命令疑问

Open
#3,094 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
151
Forks
875
PR merge metrics
No merged PRs in 30d

Description

我看了很多同学的作业,同样都导入了json。但是在我使用open 命令的时候,必须要输入完整的路径如:with open('I:/Github/selfteaching-python-camp/exercises/1901050045/d09/mymodule/tang300.json',encoding='UTF-8') as f:

而我看其他同学的作业都是with open('tang300.json','r',encoding='UTF-8').我尝试用他们的方法,打不开。提示是:FilenotfoundError:[Errno 2] No such file or directory:'tang300.json'

请问这是因为什么原因

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in exercises/1901050045/d09/mymodule and compare the process working directory with the location of tang300.json. Reproduce the FileNotFoundError using the relative path, then document why the relative and complete paths behave differently and what setup is required.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.