mycursor = cnx.cursor()if mycursor: print("Coected")sql = 'INSERT INTO phone (Name, Phone, Location) VALUES (%s, %d, %s)';n = int(input("Enter N Number For Users: "))mylist = []
for i in range(0, n): print("Enter Person "+ str(i+1) + " Information") print("========================================") Name = input("Enter Name: ") Phone = int(input("Enter Phone Number: ")) Location = input("Enter Location: ") val = (Name, Phone, Location) mylist.append(val)print(mylist)mycursor.executeman y(sql, mylist)cnx.commit()print(mycursor.rowcount, "Records Inserted.")
sql = 'INSERT INTO phone (Name, Phone, Location) VALUES (%s, %d, %s)';
برچسب:
نویسنده: خنج