vendredi 20 juillet 2018

While loop in python showing value of next word while reading a file

I have made a selenium based python program which inserts some data and if a particular set of input is right it returns it value but if the correct value is let suppose 2 then its giving the very next line as its output like 3

`f = open('a.txt', 'r') line=f.readline().strip() while line : line=f.readline().strip()

if ('Profile Information' in driver.page_source):
    count = 1
    break
    print 'username is ' , line

`

here is the output insering username 1 insering username 2

username is = 3

Aucun commentaire:

Enregistrer un commentaire