标签:open htm with open tps nes pen bre 参考 close
参考这篇博文
https://www.cnblogs.com/saryli/p/8576632.html
唯独其中:
1 with open(file_path, ‘r‘, encoding=‘utf-8‘) as f: 2 try: 3 while True: 4 line = f.readline() 5 if line: 6 r = json.loads(line) 7 # print(r) 8 else: 9 break 10 except: 11 f.close()
这段觉得不是特别妥(if line),所以本人把其改为如下:
1 with open(file_path, ‘r‘, encoding=‘utf-8‘) as f: 2 try: 3 lines = f.readlines() 4 for line in lines: 5 r = json.loads(line) 6 # print(r) 7 8 except: 9 f.close()
标签:open htm with open tps nes pen bre 参考 close
原文地址:https://www.cnblogs.com/www-caiyin-com/p/11074976.html