Q&A
cartopyで
path = "path" list_a = shpreader.Reader(path).geometries() ```と実行してでたデータをpythonのpickleファイルに入れたいのですが ```python with open("map.pkl", "w") as f: f.writelines(list_a) ```を実行すると
TypeError: write() argument must be str, not MultiLineString
writelines関数であればシーケンス型のデータを変換できると思ったのですが何が間違っているかわかりません ご教授ください --- 指摘いただいた通り writeline()関数ではなくpickle.dump()関数を使いpickle化されるように変更しました
with open("map.pkl", "w") as f:
pickle.dump(list_a, f)
TypeError Traceback (most recent call last)
<ipython-input-15-2d4fcb584b95> in <module>()
1 with open("Japan_map.pickle", "w") as f:
----> 2 pickle.dump(shapes, f)
TypeError: write() argument must be str, not bytes
回答1件
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
2018/09/24 02:56
2018/09/24 06:18
2018/09/24 06:18
2018/09/24 06:45
2018/09/24 06:46
2018/09/24 06:48
2018/09/24 12:18