Return tweets based on hashtag and save them to file.txt
<p>I would like to retreive tweets on a specific date based on their hashtag. For the purpose I'm using tweepy and the following code:</p>

<pre><code>results = api.search('#brexit OR #EUref', since="2016-06-24",
until="2016-06-30", monitor_rate_limit=True,wait_on_rate_limit=True)

with open('24june_bx.txt', 'w') as f:
    for tweet in results:
        try:
            f.write('{}\n'.format(tweet.text.decode('utf-8')))
        except BaseException as e:
            print 'ascii codec can\'t encode characters'
            continue
</code></pre>

<p>As you can see, I'm trying to get all the tweets with the hashtag '#brexit' or 'EUref', the day after the vote and store them in the file '24june_bx.txt'.
It kind of works... but in the file I only get about 10 tweets. The terminal also reports 7 times the exception and prints 'ascii codec...'.</p>

<p>What do you think may be the problem?</p>

<p>Sorry for the noobish question.</p>

<p>Many thanks.</p>