mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
Move the 3k reST doc tree in place.
This commit is contained in:
parent
739c01d47b
commit
116aa62bf5
423 changed files with 131199 additions and 0 deletions
14
Doc/includes/sqlite3/adapter_datetime.py
Normal file
14
Doc/includes/sqlite3/adapter_datetime.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
import sqlite3
|
||||
import datetime, time
|
||||
|
||||
def adapt_datetime(ts):
|
||||
return time.mktime(ts.timetuple())
|
||||
|
||||
sqlite3.register_adapter(datetime.datetime, adapt_datetime)
|
||||
|
||||
con = sqlite3.connect(":memory:")
|
||||
cur = con.cursor()
|
||||
|
||||
now = datetime.datetime.now()
|
||||
cur.execute("select ?", (now,))
|
||||
print(cur.fetchone()[0])
|
Loading…
Add table
Add a link
Reference in a new issue