mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	
		
			
	
	
		
			17 lines
		
	
	
	
		
			334 B
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			17 lines
		
	
	
	
		
			334 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
								 | 
							
								import sqlite3
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								con = sqlite3.connect("mydb")
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								cur = con.cursor()
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								newPeople = (
							 | 
						||
| 
								 | 
							
								    ('Lebed'       , 53),
							 | 
						||
| 
								 | 
							
								    ('Zhirinovsky' , 57),
							 | 
						||
| 
								 | 
							
								  )
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								for person in newPeople:
							 | 
						||
| 
								 | 
							
								    cur.execute("insert into people (name_last, age) values (?, ?)", person)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# The changes will not be saved unless the transaction is committed explicitly:
							 | 
						||
| 
								 | 
							
								con.commit()
							 |