json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

前端 未结 2 1229
Happy的楠姐
Happy的楠姐 2021-02-03 23:36

I am trying to import a file which was saved using json.dumps and contains tweet coordinates:

{
    \"type\": \"Point\", 
    \"coordinates\": [
            


        
2条回答
  •  孤独总比滥情好
    2021-02-04 00:11

    I had similar error: "Expecting value: line 1 column 1 (char 0)"

    It helped for me to add "myfile.seek(0)", move the pointer to the 0 character

    with open(storage_path, 'r') as myfile:
    if len(myfile.readlines()) != 0:
        myfile.seek(0)
        Bank_0 = json.load(myfile)
    

提交回复
热议问题