i'm using write() to write the results into a file but it does not contain the result of last loop
===

briefly, i have a code like:

    for a in range(3):
     result = 'abcd' + a
     opener = open('file.txt', "a")
     print results
     opener.write(results)

my problem is, if i run this code in shell, i can see the printed results,

    abcd0
    abcd1
    abcd2

 

but the file contains only,

    abcd0abcd1
the output i want is,

    abcd0abcd1abcd2
any suggestions? i can't find what's wrong with this code...

any help would be really great. thanks in advance


