Scripts_of_Python_Programming_Book
Scripts_of_Python_Programming_Book copied to clipboard
my output not matched with your output in chapter 10
this is my code
f = open("demofile.txt","r")
print(f.read ())
output
C:\Users\My Name>python demo_file_open.py Hello! Welcome to demofile.txt This file is for testing purposes. Good Luck!
f = open("demofile.txt","r") print(f.read(50))
output
C:\Users\My Name>python demo_file_open.py Hello!
f = open("demofile.txt", "r")
print(f.readline()) print(f.readline())
output
C:\Users\My Name>python demo_file_open.py
Hello! Welcome to demofile.txt
f = open("demofile.txt","r" ) for a in f: print(a)
output
C:\Users\My Name>python demo_file_open.py Hello! Welcome to demofile.txt This file is for testing purposes. Good Luck!
f = open("demofile.txt","r") print(f.readline()) f.close()
output
C:\Users\My Name>python demo_file_open.py
f = open("demofile2.txt","a") f.write("Now the file has more content!") f.close()
f = open("demofile2.txt","r") print(f.read())
output
Now the file has more contentNow the file has more content!
f = open("demofile3.txt","w") f.write("i have deleted the content") f.close() f = open("demofile3.txt","r") print(f.read())
output i have deleted the content
f = open("demofile.txt","r") print(f.read(5))
output
C:\Us