Python3實踐日記:使用文件寫的時候,一直報TypeError: a bytes-like object is required, not 'str'

問題發現 使用python3在做一個將html轉化成json格式的工具 使用語句:with open('mytest1.json','wb') as fp: json.dump(content,fp=fp,indent=4) 運行後,一直報TypeError: a bytes-like object is required, not ‘str’ 問題分析 轉了一大圈,花費了將近一個小時,才發現問題
相關文章
相關標籤/搜索