teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

追加質問への回答を記載

2018/02/13 15:45

投稿

umyu
umyu

スコア5846

answer CHANGED
@@ -40,4 +40,29 @@
40
40
 
41
41
 
42
42
  あとはtwitter APIとのやり取りは自作するより、
43
- [python-twitter](https://github.com/bear/python-twitter) または [tweepy](https://github.com/tweepy/tweepy)のライブラリを使用する形の方がいいです。
43
+ [python-twitter](https://github.com/bear/python-twitter) または [tweepy](https://github.com/tweepy/tweepy)のライブラリを使用する形の方がいいです。
44
+
45
+ ---
46
+
47
+ 2018/02/14追記
48
+
49
+ 以下のコードだと'full_text'という文字列に対してreplaceを行っています。以下のように変更してください。
50
+ ```Python
51
+ f.write(tweet['full_text'.replace('\r\n', '')])
52
+ ```
53
+
54
+
55
+
56
+ ```Python
57
+ f.write(tweet['full_text'].replace('\r\n', ''))
58
+ ```
59
+
60
+ 分かりづらいなって思った時は作業変数を1個増やすとデバック確認が行いやすいです。
61
+ 例えば以下のようなfull_text という変数を1個増やす形です。
62
+
63
+ ```Python
64
+ full_text = tweet['full_text']
65
+ print(full_text)
66
+ print(full_text.replace('\r\n', ''))
67
+ f.write(full_text.replace('\r\n', ''))
68
+ ```