-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfileProcessing.py
More file actions
44 lines (35 loc) · 1.06 KB
/
Copy pathfileProcessing.py
File metadata and controls
44 lines (35 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# file = open('data.txt', 'r')
# s1 = file.read()
# print(s1)
# file.close()
# f = open('jj.txt', 'w')
# f.write('hello world')
# # Function to read and write files
# def readWriteFile():
# with open("data.txt", "r") as f:
# content =f.read()
# print(content)
# with open("newfile.text", "w") as nf:
# nf.write(content)
# nf.write("\nFile copied successfully!")
# print("File operations completed.")
# readWriteFile()
# # Function to append data to a file
# def appendData():
# with open("data.txt", "a") as f:
# content = "NEW APPENDED CONTENT"
# f.write("\n", content)
# appendData()
# def appendData2():
# f = open("data.txt", "a")
# f.write("\nNEW APPENDED CONTENT")
# f.close()
# # 3. Write a program that prompts the user for their name. When they respond, write their
# # name to a file called guest.txt.
# def writeName():
# name = input("Enter your name")
# f = open("guest.txt", "w")
# f.write(name)
# f.close()
# print("Your name has been written")
# writeName()