Author Topic: [Python] Nested for loops problem  (Read 968 times)

LavaThemes

  • Dev Team Member
  • Hero Member
  • *****
  • Posts: 757
  • Reputation: 34
  • Aspiring Developer
  • iDevices: iTouch 4
[Python] Nested for loops problem
« on: May 20, 2012, 08:13:15 pm »
i have a set of nested loops that run through a list of passwords for each item in a list of usernames. But for some reason the first loop only runs once, for the first item in that list. Its really bothering me and I've scanned intensely for whitespace errors (These usually break my code :P )


http://i782.photobucket.com/albums/yy104/ethan123c/eror.jpg
« Last Edit: May 20, 2012, 09:05:52 pm by C0deH4cker »

A12danrulz

  • Leader
  • Hero Member
  • *****
  • Posts: 4015
  • Reputation: 216
  • Badges:
Re: [Python] Nested for loops problem
« Reply #1 on: May 20, 2012, 08:32:57 pm »
Can you upload it with ininjas? Opendns blocks photobucket

LavaThemes

  • Dev Team Member
  • Hero Member
  • *****
  • Posts: 757
  • Reputation: 34
  • Aspiring Developer
  • iDevices: iTouch 4
Re: [Python] Nested for loops problem
« Reply #2 on: May 20, 2012, 08:39:39 pm »
Sorry, here it is.


A12danrulz

  • Leader
  • Hero Member
  • *****
  • Posts: 4015
  • Reputation: 216
  • Badges:
Re: [Python] Nested for loops problem
« Reply #3 on: May 20, 2012, 08:48:09 pm »
I cant tell exactly, but if I had to guess Id say your 'if not (...' code block

C0deH4cker

  • Hero Member
  • *****
  • Posts: 2849
  • Reputation: 129
  • I am leaving iNinjas. Contact me via email.
  • Badges:
  • iDevices: iPhone 4S 16gb Black (5.1.1), iPad 2 32gb White (5.0.1), iPod Touch 2G 8gb (4.2.1)
Re: [Python] Nested for loops problem
« Reply #4 on: May 20, 2012, 09:08:49 pm »
instead of saying "for line in myFileVariable:", do this: "for line in myFileVariable.realines():".

Don't like seeing ads? Click here to register!

Trcx528

  • Haxor
  • Hero Member
  • *****
  • Posts: 4501
  • Reputation: 166
  • Google it!
    • iNinjas
  • Badges:
  • Computers: 13" 2011 Macbook Pro, 120 GB SSD and 16 GB of Ram
  • iDevices: None
Re: [Python] Nested for loops problem
« Reply #5 on: September 04, 2012, 03:05:13 pm »
Sorry for necrobump, but why does your
Code: [Select]
if not (login == b"Bad login" or login == b"Account migrated, use e-mail as username.")
have b's before the quotes? 

LavaThemes

  • Dev Team Member
  • Hero Member
  • *****
  • Posts: 757
  • Reputation: 34
  • Aspiring Developer
  • iDevices: iTouch 4
Re: [Python] Nested for loops problem
« Reply #6 on: September 04, 2012, 03:07:30 pm »
It has something to do with bytes and encodings. I haven't touched this in a long time and when I worked with this i had little python skill therefore I don't really remember/understand. The problem was based on the responses being raw data.

Also, If I remember correctly, when I printed the responses from minecraft.net they had that in front of them.