I want to add lines to an existing file in python. I wrote the following two files
print_lines.py
while True:
curr_file = open('myfile',r)
lines = curr_file.readlines()
for line in lines:
print lines
add_lines.py
curr_file = open('myfile',w)
curr_file.write('hello world')
curr_file.close()
but when I run first print_lines.py
and then add_lines.py
I don't get the new line I add. How can I solve it?