We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 52d62ac commit dfca324Copy full SHA for dfca324
fileoperation
@@ -0,0 +1,18 @@
1
+file_name = "example.txt"
2
+with open(file_name, "w") as file:
3
+ file.write("Hello, this is a sample file.\n")
4
+
5
6
+with open(file_name, "r") as file:
7
+ content = file.read()
8
+ print("Content of the file:")
9
+ print(content)
10
11
12
+with open(file_name, "a") as file:
13
+ file.write("This is some additional text.\n")
14
15
16
17
+ print("\nUpdated content of the file:")
18
0 commit comments