0
這是我的代碼,當我運行它時,我得到第19行(for循環)的錯誤: TypeError:object'int'不可迭代。Python類型錯誤對象int不可迭代
import fb
from facepy import GraphAPI
token=""# access token here.
facebook=fb.graph.api(token)
graph1 = GraphAPI(token)
vid="" #page id here
query=str(vid)+"/feed"
r=graph1.get(query)
count=0
nos=input("Enter number of posts: ")
for indid in nos:
count=count+1
facebook.publish(cat="feed",id=indid,message="Hi"+str(count))
time.sleep(6)
print("Wall post:"+str(count))
else :
print("No posts made.")
請告訴我什麼是錯的。
請做一些研究,這是一個非常基本的錯誤,只是簡單地用你的錯誤信息穀歌應該引導你許多SO問題相同的問題;例如https://stackoverflow.com/questions/19523563/python-typeerror-int-object-is-not-iterable或https://stackoverflow.com/questions/3887381/typeerror-nonetype-object-is-not-iterable- in-python或者https://stackoverflow.com/questions/18595695/python-typeerror-int-object-is-not-iterable et cetera。 – l4mpi 2014-10-31 07:39:23