Update print statements to print() functions
This commit is contained in:
parent
0702b4bce1
commit
4f1e41a9e5
3 changed files with 7 additions and 7 deletions
|
|
@ -98,7 +98,7 @@ That being said, Twython offers a generator for search results and can be access
|
|||
|
||||
results = twitter.cursor(twitter.search, q='python')
|
||||
for result in results:
|
||||
print result
|
||||
print(result)
|
||||
|
||||
Manipulate the Request (headers, proxies, etc.)
|
||||
-----------------------------------------------
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ The Old Way
|
|||
results = twitter.search(q='twitter')
|
||||
if results.get('statuses'):
|
||||
for result in results['statuses']:
|
||||
print result['id_str']
|
||||
print(result['id_str'])
|
||||
|
||||
The New Way
|
||||
^^^^^^^^^^^
|
||||
|
|
@ -39,7 +39,7 @@ The New Way
|
|||
|
||||
results = twitter.cursor(twitter.search, q='twitter')
|
||||
for result in results:
|
||||
print result['id_str']
|
||||
print(result['id_str'])
|
||||
|
||||
Another example:
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ Another example:
|
|||
|
||||
results = twitter.cursor(t.get_mentions_timeline)
|
||||
for result in results:
|
||||
print result['id_str']
|
||||
print(result['id_str'])
|
||||
|
||||
|
||||
HTML for Tweet
|
||||
|
|
@ -66,7 +66,7 @@ This function takes a tweet object received from the Twitter API and returns an
|
|||
include_rts=True)
|
||||
for tweet in user_tweets:
|
||||
tweet['text'] = Twython.html_for_tweet(tweet)
|
||||
print tweet['text']
|
||||
print(tweet['text'])
|
||||
|
||||
The above code takes all the tweets from a specific users timeline, loops over them and replaces the value of ``tweet['text']`` with HTML.
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ Now set up how you want to handle the signals.
|
|||
class MyStreamer(TwythonStreamer):
|
||||
def on_success(self, data):
|
||||
if 'text' in data:
|
||||
print data['text'].encode('utf-8')
|
||||
print(data['text'])
|
||||
|
||||
def on_error(self, status_code, data):
|
||||
print status_code
|
||||
print(status_code)
|
||||
|
||||
# Want to stop trying to get data because of the error?
|
||||
# Uncomment the next line!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue