嘗試使用python腳本將給定的文本文件轉換爲.json
文件。 我試圖將雙引號附加爲:output_str = '"'+input_str+'"'
,但它會在輸出中產生兩次雙引號。附加「結果追加」2次
i.e. if input_str = row
output_str = ""row"" instead of "row"
row.append(str)
writer = csv.writer(open("data.json",'wb'), delimiter=',')
writer.write(row)
有什麼建議嗎?
這個問題很混亂。你輸出到JSON,你想要雙引號,或者你不想雙引號?你可以在你的問題上發佈你的代碼嗎? – StephenH
有關爲何需要代碼的說明,請參閱http://stackoverflow.com/help/mcve或http://SSCCE.ORG –
您確定'input_str'尚未包含雙引號嗎?因爲它看起來像它。 – poke