0
我無法找出爲什麼下面的代碼行不起作用:如何解決錯誤「ValueError:期望,定界符」?
text = '''{"seasons":"[{"season-type":"type1","start-day":10,"start-month":1,"end-day":31,"end-month":5},{"season-type":"type2","start-day":1,"start-month":9,"end-day":9,"end-month":1},{"season-type":"type3","start-day":1,"start-month":6,"end-day":30,"end-month":9}]"}'''
obj = json.loads(text)
obj
我收到以下錯誤ValueError: Expecting , delimiter: line 1 column 16 (char 15)
你似乎已經引用列表,它是價值的鍵'「季節」'是指。 – quamrana
它必須是'text ='''{「seasons」:[{「season-type」...]}'''' –
@quamrana:好的,我明白了。我怎樣才能將它轉換成有效的JSON字符串? – Dinosaurius