Skip to content

Commit

Permalink
解决 Windows 上的 gbk 报错,在读写 txt 时指定使用 utf-8 编码。
Browse files Browse the repository at this point in the history
  • Loading branch information
x1ao4 authored Nov 26, 2023
1 parent f60de82 commit 7c30f9b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions auto-update-episodes/auto-update-episodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
except:
pass

with open(DATA_FILE, 'r') as file:
with open(DATA_FILE, 'r', encoding='utf-8') as file:
data = file.readlines()

success_count = 0
Expand Down Expand Up @@ -66,7 +66,7 @@

# Remove the line from the remaining data and update the file
remaining_data.remove(line)
with open(DATA_FILE, 'w') as file:
with open(DATA_FILE, 'w', encoding='utf-8') as file:
for line in remaining_data:
file.write(line)

Expand Down

0 comments on commit 7c30f9b

Please sign in to comment.