python - readline(): I cannot display string -



somehow lost! has hint why check_date string not displayed in output?

thanks!
m

with open(lastpull,"r") f:   check_date = f.readline()  if check_date == date:   print "\nno new data. pulled today already.\n"   exit() else:   print "\nnew data found!\n"   print "lastpull date : ", check_date   print "actual date   : ", date 

output:

 new data found!  lastpull date :   actual date   :  2013-07-11 

check_date should first line including newline.

the way not have newline in output file single line no newline.

apparently line whitespace (or possibly empty exact output suggest).

you try

print "lastpull date : ", repr(check_date) 

to better see what's going on.

it lastpull isn't think is. double check 0 length file.


Comments