-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadduser.py
More file actions
33 lines (30 loc) · 1.16 KB
/
adduser.py
File metadata and controls
33 lines (30 loc) · 1.16 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
import csv
import os
from email_validator import validate_email, EmailNotValidError
def Add_User():
x = int(input("Enter number of Users to be added:"))
for i in range(0,x):
u_name = input("Enter UserName:")
u_age = input("Enter Age:")
u_email = input("Enter Email Adress:")
def email():
try:
valid = validate_email(u_email)
email = valid.email
except EmailNotValidError as e:
print(str(e))
validate_email(u_email)
u_phone = input("Enter Phone Number:")
pt1 = tuple(u_phone)
if len(pt1) != 10:
print("Error: Please enter the right number")
u_phone = input("Enter Phone Number:")
writefile = open("userdetails.csv","a",newline="")
tophead = ["NAME","AGE","EMAIL","PHONE No:"]
addrow = csv.writer(writefile)
writefile.close()
with open("userdetails.csv","a",newline="") as writefile:
writerow = csv.writer(writefile)
writerow.writerow([u_name,u_age,u_email,u_phone])
writefile.close()
return