Use the function open() to open the file.
A file object with a method read() is the function open() returns, allowing you to read the contents of the file:
f = open("fichierdemo.txt", "r")
print(f.read())
f = open("fichierdemo.txt", "r")
print(f.read(10))
f = open("fichierdemo.txt", "r")
print(f.readline())
f = open("fichierdemo.txt", "r")
for x in f:
print(x)
Please disable your ad blocker and refresh the window to use this website.