Explicitly specify encoding when opening text files in Python code
This commit is contained in:
1 parent
fa4b9065a8
commit
634bd97001
19 files changed
+38
-38
No files matched your search
@@ -13,8 +13,8 @@ pattern = args.pattern
|
||||
outfile = args.outfile
|
||||
|
||||
in_remove = False
|
||||
with open(tracefile, 'r') as f:
|
||||
with open(outfile, 'w') as wf:
|
||||
with open(tracefile, 'r', encoding="utf8") as f:
|
||||
with open(outfile, 'w', encoding="utf8") as wf:
|
||||
for line in f:
|
||||
for p in pattern:
|
||||
if line.startswith("SF:") and p in line:
|
||||
|
||||
Reference in new issue
Block a user