TypeError: Object of type 'Tag' ist nicht als JSON serialisierbar

Ich versuche zu erstellen JSON Objekt und senden Sie es an die Firebase Database mit python, aber wenn ich das mache bekomme ich:

TypeError: Object of type 'Tag' is not JSON serializable

Hier ist mein code:

data = {'address': address,
    'name': name
   }

print(type(data))
sent = json.dumps(data)
result = firebase.post("/tHouse/houseTest", sent)  

Das ist etwas falsch mit json.dumps(data) da die Fehler hingewiesen hier. Läuft print(type(data)) zurück, obwohl <class 'dict'>.

Auch die name und address sind vorher festgelegt

  • Was sind die Arten von address und name?
  • mit address = "address", name = "name" dein code funktioniert einwandfrei, bis json.dumps(data) Hinzufügen vollen traceback-so, dass jemand helfen kann
  • name ist String, aber address zu sein scheint 'bs4.element.Tag' ... kann ich nur tun str(address) dieses Problem zu beheben ?
InformationsquelleAutor anho | 2017-07-13
Schreibe einen Kommentar