Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

my output not matched with your output in chapter 10 #5

Open
GulrezAnwar opened this issue Sep 19, 2023 · 0 comments
Open

my output not matched with your output in chapter 10 #5

GulrezAnwar opened this issue Sep 19, 2023 · 0 comments

Comments

@GulrezAnwar
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant