From b294507167f0be12e6ccfc147e30d4405b71c602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=80=E5=8D=9A?= <2758032428@qq.com> Date: Mon, 23 Sep 2024 02:31:20 +0000 Subject: [PATCH] =?UTF-8?q?update=20Python=E9=AB=98=E7=BA=A7=E7=BC=96?= =?UTF-8?q?=E7=A8=8B/=E4=B8=8A=E4=B8=8B=E6=96=87=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=99=A8=20=E8=AF=BB=E6=96=87=E6=9C=AC=E6=96=87=E4=BB=B6.py.?= =?UTF-8?q?=20=E6=B7=BB=E5=8A=A0=EF=BC=9A=E7=94=B1=E4=BA=8E=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=BC=96=E7=A0=81=E9=97=AE=E9=A2=98=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E3=80=82=E5=9C=A8=E6=89=93=E5=BC=80=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=8F=AF=E6=8C=87=E5=AE=9A=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E4=B8=BA'utf-8'=20file=5Fhandler=20=3D=20ope?= =?UTF-8?q?n(file=5Fname,=20'r',encoding=3D'utf-8')?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 赵一博 <2758032428@qq.com> --- ...\257\273\346\226\207\346\234\254\346\226\207\344\273\266.py" | 2 ++ 1 file changed, 2 insertions(+) diff --git "a/Python\351\253\230\347\272\247\347\274\226\347\250\213/\344\270\212\344\270\213\346\226\207\347\256\241\347\220\206\345\231\250 \350\257\273\346\226\207\346\234\254\346\226\207\344\273\266.py" "b/Python\351\253\230\347\272\247\347\274\226\347\250\213/\344\270\212\344\270\213\346\226\207\347\256\241\347\220\206\345\231\250 \350\257\273\346\226\207\346\234\254\346\226\207\344\273\266.py" index 845b884..590677a 100644 --- "a/Python\351\253\230\347\272\247\347\274\226\347\250\213/\344\270\212\344\270\213\346\226\207\347\256\241\347\220\206\345\231\250 \350\257\273\346\226\207\346\234\254\346\226\207\344\273\266.py" +++ "b/Python\351\253\230\347\272\247\347\274\226\347\250\213/\344\270\212\344\270\213\346\226\207\347\256\241\347\220\206\345\231\250 \350\257\273\346\226\207\346\234\254\346\226\207\344\273\266.py" @@ -49,6 +49,8 @@ def open_func(file_name): # __enter__方法 print('open file:', file_name, 'in __enter__') file_handler = open(file_name, 'r') + # 由于文件编码问题导致的。在打开文件时,可指定编码格式为'utf-8' + # file_handler = open(file_name, 'r',encoding='utf-8') # 【重点】:yield yield file_handler -- Gitee