Jump to content

Python loop issue with twitter client?

- - - - -

  • Please log in to reply
2 replies to this topic

#1
mikedemon

mikedemon

    Newbie

  • Members
  • Pip
  • 2 posts
ount
csvout.writerow([name, followers])
print name + ", " + str(followers)

csvfile.close()[/CODE]

Edited by mikedemon, 11 July 2011 - 03:19 PM.


#2
Soram

Soram

    Newbie

  • Members
  • Pip
  • 1 posts
what does this do ?
[name.strip() for name in listofnames]

#3
ZekeDragon

ZekeDragon

    Writes binary right handed and hex left handed

  • Moderators
  • 2,103 posts
@Soram: That piece of code will create a new list based on listofnames, except with all the whitespace on either side stripped off.

for name in listofnames:

account = api.GetUser(name)

followers = account.followers_count

csvout.writerow([name, followers])

print name + ", " + str(followers)
Unfortunately you didn't originally post your code in [noparse]
[/noparse] tags, so there's no way to tell what the indentation is like, but to me it seems like this problem would occur because of an indentation issue. So before I go further into this, here's the correct indentation:

[code]for name in listofnames:

    account = api.GetUser(name)

    followers = account.followers_count

    csvout.writerow([name, followers])

    print name + ", " + str(followers)
Please tell me if you're still having an issue.
Wow I changed my sig!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users