データリストをCSVファイルに変換しようとしています。リスト内の要素を分割して置換し、CSVに変換
リストは、csvファイルデータ
['time\ntimestamp\nrecordtime\nlat\nlong\nalt\nspeed\ncourse\nverticalAccuracy\nhorizontalAccuracy\nlocTimeStamp\naccelerationX\naccelerationY\naccelerationZ\nHeadingX\nHeadingY\nHeadingZ\nTrueHeading\nMagneticHeading\nHeadingAccuracy\nRotationX\nRotationY\nRotationZ\nmotionYaw\nmotionRoll\nmotionPitch\nmotionRotationRateX\nmotionRotationRateY\nmotionRotationRateZ\nmotionUserAccelerationX\nmotionUserAccelerationY\nmotionUserAccelerationZ\nen0\npdp_ip0\nDeviceOrientation\nState', '2014-11-19 08:57:45.696;1;1;52.33705;4.843468;8.319668;20.44;93.05875;6;5;1416383865;0.0806427;-0.4734802;-0.7419281;-16.14367;27.67606;-15.92525;53.06408\n52.48165;26;0.04704554;0.9128267;0.4871223;0.1783603;0.2536548;0.6368796;0.07435028;0.8879893;0.4615479;-0.1116289;0.1097959;0.04115437;0.0.0.0;10.167.22.1;1;0','2014-11-19 08:57:45.696;1;1;52.33705;4.843468;8.319668;20.44;93.05875;6;5;1416383865;0.0806427;-0.4734802;-0.7419281;-16.14367;27.67606;-15.92525;53.06408\n52.48165;26;0.04704554;0.9128267;0.4871223;0.1783603;0.2536548;0.6368796;0.07435028;0.8879893;0.4615479;-0.1116289;0.1097959;0.04115437;0.0.0.0;10.167.22.1;1;0']
と呼ばCSVと呼ばれ、このように見えるようになっている。言い換えれば
time,timestamp,recordtime,lat,long,alt,...,State
2014-11-19 08:57:45.696, 1, 1, 52.33705, 4.843468, 8.319668,..,0
2014-11-19 08:57:45.696, 1, 1, 52.33705, 4.843468, 8.319668,..,0
、'\n'
を置き換えることがようになりました','
と','
改行があり、これらの行に3210がある必要があります','
です。私はどこから始めるべきかわかりません。
[こちら](https://docs.python.org/2/library/string.html#string.replace)を開始してください。 –
'str'オブジェクトは' split'コマンドを持っています。 '' a \ nb \ nc'.split( '\ n') 'は' ['a'、 'b'、 'c'] 'になります。 –
ありがとうございました。それは私のために完全ではなかった。 – mroWsymaS