Python Weirdness

Questions about programming languages and debugging
Post Reply
User avatar
maboroshi
Dr. Mab
Dr. Mab
Posts: 1624
Joined: 28 Aug 2005, 16:00
18

Python Weirdness

Post by maboroshi »

Need help with a bit of Python code

Code: Select all

    with open("test.txt", 'r') as infile:
        lines_gen = infile.readlines()
        for i in range(0, len(lines_gen), 8):
            (firstname,
             lastname,
             email,
             email_confirm,
             password,
             month,
             day,
             year) = lines_gen[i:i+8]
            
            print type(firstname)
            browser.wk_fill('input[name="firstname"]', firstname)
Why is the firstname argument not being passed to wk_fill, its of type string which the function expects.

It happens with all the options. But if I type say "maboroshi" its passed no problem. Any ideas?

Cats, Lundis? Anyone else :-)

User avatar
maboroshi
Dr. Mab
Dr. Mab
Posts: 1624
Joined: 28 Aug 2005, 16:00
18

Re: Python Weirdness

Post by maboroshi »

LMAO solved by doing this

Code: Select all

firstname = firstname.rstrip("\n")

Post Reply