How do I place multiple searched tweets into string
<p>I have a program set up so it searches tweets based on the hashtag I give it and I can edit how many tweets to search and display but I can't figure out how to place the searched tweets into a string. this is the code I have so far</p>

<pre><code>    while True:
        for status in tweepy.Cursor(api.search, q=hashtag).items(2):
                tweet = [status.text]
print tweet
</code></pre>

<p>when this is run it only outputs 1 tweet when it is set to search 2 </p>

<p>Your code looks like there's nothing to break out of the <code>while</code> loop. One method that comes to mind is to set a variable to an empty list and then with each tweet, append that to the list.       </p>

<pre><code>foo = []
for status in tweepy.Cursor(api.search, q=hashtag).items(2):
   tweet = status.text
   foo.append(tweet)
print foo
</code></pre>

<p>Of course, this will print a list. If you want a string instead, use the string <em>join()</em> method. Adjust the last line of code to look like this:</p>

<pre><code>bar = ' '.join(foo)
print bar
</code></pre>

python string output tweepy tweets