import time
def fibonacci():
i=0
while True:
i=i+1
yield i
fib=fibonacci()
while 1 == 1:
try:
a = fib.next()
print a
time.sleep(5)
except (StopIteration), e:
print e
print 'i am break'
break;
C:Python27python.exe "C:/Users/TLCB/PycharmProjects/untitled/mycompany/baidu api/a6.py"
1
2
3
4
5
6
7
8