On 10/15/2015 9:00 AM, Reuben wrote:
Hi All,

I need some clarification for below code. In line 2 of below code snippet,
I have provided read and write permission. Assuming I have provided some
string input as requested in line 1 - when I try to open "check.txt" file
after running the script, it is always empty - it does not display the user
input provided.

May I know why?

######################################################################

input1 = raw_input("Input1:")


file = open("check.txt", "r+")

file.write(input1 + "\n")



Also, the line below continues from the last insertion -- you'll also need to reposition the file pointer or re-open the file.

Emile


for line in file:
         print line


print file.close()

######################################################################


Regards,
RD.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to