-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathread_input_func.py
More file actions
42 lines (29 loc) · 981 Bytes
/
read_input_func.py
File metadata and controls
42 lines (29 loc) · 981 Bytes
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
# [fn, ln, email, phone, address, loc, hobbies, sports]
def render_input(val):
d={}
for row in val:
x=input("Enter the :%s::"%row)
d[row]=x
return d
data = render_input(
['fn', 'ln', 'email', 'phone', 'address', 'loc', 'hobbies', 'sports']
)
print("Data Here is:",data)
def writedata(data_file):
with open("output_data.txt", "w") as fp:
y = 0
fn = data_file.pop("fn")
ln = data_file.pop("ln")
z = None
fp.write("{}: {}\n".format("Full Name".ljust(10), fn+" "+ln))
for row, col in data_file.items():
y+=1
if y == 1:
z = "{}: {}\t".format(row.ljust(10),col.ljust(15))
if y == 2:
z += "{}: {}\n".format(row.ljust(10),col)
fp.write(z)
z=None
y=0
fp.close()
writedata(data)