Python 用于While循环问题

Python 用于While循环问题,python,if-statement,for-loop,while-loop,break,Python,If Statement,For Loop,While Loop,Break,我面临一个非常简单的嵌套循环的非常奇怪的行为。这是代码,当我使用count

我面临一个非常简单的嵌套循环的非常奇怪的行为。这是代码,当我使用
count<10
时,一切正常。但是当我把计数增加到10以上,我得到一个无限循环,我不知道错误在哪里。代码如下:

count = 0
while True:

    if count >= 10:
        break

    for tweet in c:
        tweets.append(tweet)
        print 'Upper Loop Date: ' + str(tweet.created_at) + "   " + str(count)
        count += 1
        if count >= 10:
            break

    for tweet in reversed(tweets):
        print 'Lower Loop Date: ' + str(tweet.created_at) + "   " + str(count)
这就是结果,日期先减后增,正是我想要的:

Upper Loop Date: 2017-02-01 23:59:55   0
Upper Loop Date: 2017-02-01 23:59:50   1
Upper Loop Date: 2017-02-01 23:59:50   2
Upper Loop Date: 2017-02-01 23:59:38   3
Upper Loop Date: 2017-02-01 23:59:35   4
Lower Loop Date: 2017-02-01 23:59:35   5
Lower Loop Date: 2017-02-01 23:59:38   5
Lower Loop Date: 2017-02-01 23:59:50   5
Lower Loop Date: 2017-02-01 23:59:50   5
Lower Loop Date: 2017-02-01 23:59:55   5

如果我用大于10的数字替换count,我会得到一个无限循环。

如果
c
没有足够的
tweets
,这将永远运行。。。如果c只包含5条tweet,那么你的输出非常有意义。谢谢,你救了我的命!或者,保存了我的文件?