1 Réponse
0
# Hi!
# When you use open() in Python,
# you read and write files from your computer.
# Write (create) a file on your computer:
with open("myFile.txt", "w") as f:
f.write("Hello World")
# Read a file from your computer:
with open("myFile.txt", "r") as f:
s = f.read()
# The file is opened and read from your
# computer, and assigned to the variable s.
# You can also open the file "myFile.txt" with
# for example Windows Notes on your computer.
# Print the read file, stored on your computer:
print(s)