0
私はこのプロジェクトを使用して生成されたつぶやきを含むCSVファイルを使って作業しています:https://github.com/Jefferson-Henrique/GetOldTweets-python。 csvファイルでcsvファイルからdictを作成
2人の最初のつぶやき、および見出しは以下に見られることができます。
username;date;retweets;favorites;text;geo;mentions;hashtags;id;permalink;;
thepsalami;02-04-2014 01:59;0;2;Must be #aprilfools because everyone is
saying #HIMYM is over! Haha it'll never stop as long as we hold fast to the
memories.;;;#aprilfools #HIMYM;
4,51147E+17;https://twitter.com/thepsalami/status/451146992131923968;;
shahanasiddiqui;02-04-2014 01:59;0;0;@promahuq yeah B-R was no surprise -
the ending was just right. My FB turned into #HIMYM blog site! Man that show
had a huge impact!;;@promahuq;#HIMYM;4,51147E+17;https://twitter.com/shahanasiddiqui/status
/451146991955759105;;
私は簡単に、例えばアクセスできるように辞書でこれを保存したいですユーザー名、時間、またはテキスト。私はcsv.DictReader使用してみました:
input_file = csv.DictReader(open("HIMYM_tweets.csv"))
をしかし、それは非常に奇妙なものになり:
{'username;date;retweets;favorites;text;geo;mentions;hashtags;id;permalink;;':
"thepsalami;02-04-2014 01:59;0;2;Must be #aprilfools because everyone is
saying #HIMYM is over! Haha it'll never stop as long as we hold fast to the
memories.;;;#aprilfools #HIMYM; 4", None:['51147E+17;https://twitter.com/thepsalami/status/451146992131923968;;']}
{'username;date;retweets;favorites;text;geo;mentions;hashtags;id;permalink;;': ' ....
、このような辞書を作成、または多分賢く何かをやって上の任意のヘルプは非常に高く評価され:D
ヒントを動作するはずです:区切り文字を見てください。 –
Oohので、DictReaderはカンマ区切りであるとみなしますか? :) – Linda