jackfrued / jackfrued/Python-100-Days

DAY11文件打开错误

Open
#380 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
187k
Forks
55.8k
PR merge metrics
No merged PRs in 30d

Description

for-in 逐行读取文件代码第11行和第17行open函数未指定编码错误
Traceback (most recent call last):
File "c:\Users\14345\Documents\codes\python\python_100_Days\Python-100-Days-master\Day01-15\code\Day11\test.py", line 23, in
main()
File "c:\Users\14345\Documents\codes\python\python_100_Days\Python-100-Days-master\Day01-15\code\Day11\test.py", line 11, in main
for line in f:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 4: illegal multibyte sequence
image

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

Open Day01-15/code/Day11/test.py and inspect the open calls at lines 11 and 17. Reproduce the UnicodeDecodeError on the file-reading example, then verify that the corrected encoding handling allows the example to read the file successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.