Python- TypeError Object Int Is Not Iterable
Here is my code, when I am running it I get error on line 19 (for loop): TypeError: object 'int' is not iterable. import fb from facepy import GraphAPI token=''# access token h
Solution 1:
Well, the error says it all: you try to iterate over an int
in the for
loop of this code:
nos=input("Enter number of posts: ") # nos is an int here
for indid in nos: # and this is not how you iterate over an int
count=count+1
facebook.publish(cat="feed",id=indid,message="Hi"+str(count))
make a range instead:
for count in range(0, nos):
facebook.publish(cat="feed",id=count,message="Hi"+str(count))
furthermore: I don't know what you try to do with indid
. Maybe you also want to ask for the postid you want to change...
Post a Comment for "Python- TypeError Object Int Is Not Iterable"