小编Ari*_*dee的帖子

如何修复Python at Object of type datetime is not JSON可序列化错误

我使用 Twitter 进行数据挖掘。因此,我从 Twitter 获取值 create_at 并将其保存在 Excel 文件中,然后将 Excel 文件发送到 Google Sheet,但无法发送它。
它有这样的错误:

response = service.spreadsheets().values().append(
File "C:\Users\What Name\AppData\Local\Programs\Python\Python38-32\lib\site- 
packages\googleapiclient\discovery.py", line 830, in method
headers, params, query, body = model.request(
File "C:\Users\What Name\AppData\Local\Programs\Python\Python38-32\lib\site- 
packages\googleapiclient\model.py", line 161, in request
body_value = self.serialize(body_value)
File "C:\Users\What Name\AppData\Local\Programs\Python\Python38-32\lib\site- 
packages\googleapiclient\model.py", line 274, in serialize
return json.dumps(body_value)
File "C:\Users\What Name\AppData\Local\Programs\Python\Python38-32\lib\json\__init__.py", line 231, 
in dumps
return _default_encoder.encode(obj)
File "C:\Users\What Name\AppData\Local\Programs\Python\Python38-32\lib\json\encoder.py", line 199, in 
encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Users\What Name\AppData\Local\Programs\Python\Python38-32\lib\json\encoder.py", line 257, in 
iterencode
return …
Run Code Online (Sandbox Code Playgroud)

python twitter json data-mining google-sheets

5
推荐指数
1
解决办法
3万
查看次数

标签 统计

data-mining ×1

google-sheets ×1

json ×1

python ×1

twitter ×1