:Python - ファイルに書き込みしませんか?私はこのようなファイルへの書き込みをしようとしている
debugfile = open("file.txt", "w")
debugfile.write("%i" % (feature['properties']['cellId']))
debugfile.close()
ここfeature['properties']['cellId']
は整数です。ファイルは作成されますが、空のままです。私は何が欠けていますか?
更新 コンソールに書き込もうとしました。
debugfile = open("file.txt", "w")
print(feature['properties']['cellId'])
debugfile.write("%i" % (feature['properties']['cellId']))
debugfile.close()
'feature'はテストできないのですが、' debugfile.write( "%i"%42) 'はうまく動作します。だから何かが間違っている。エラーが発生しましたか?あなたの事例をあなたのために失敗しても、実行できるものに更新できますか?たぶん 'print(' feature ['properties'] ['cellId']) 'を追加して、それを投稿しますか? – tdelaney
LOL - あなたしました!それは速い。 – tdelaney
文字列フォーマット – handle