我有一个这样的访问表(日期格式为毫米/日/年)保持空白单元格空白而不是无由蟒
col_1_id ----- COL_2
1 1/1/2003
3 1/5/2009
5 2008年3月2日
输出应该是一个表,其中Co_1是2至4(空白小区必须为空)
3 1/5/2009
我试过用sql查询。输出在空白单元中打印“无”。我需要空白单元格中的空白。 另一件事是当我试图插入这个值在另一个表中,它只插入具有日期值的 行。代码在没有日期的情况下获取任何行时停止。我需要按照原样插入行。
我在蟒蛇试图与
import pyodbc
DBfile = Data.mdb
conn = pyodbc.connect ('Driver = {Microsoft Access Driver (*.mdb)}; DBQ =' +DBfile
cursor = conn.cursor()
sql_table = "CREATE TABLE Table_new (Col_1 integer, Col_2 Date)"
cursor.execute.sql_table()
conn.commit()
i = 0
while i => 2 and i <= 4:
sql = "INSERT INTO New_Table (Col_1, Col_2)VALUES ('%s', '%s')" % (A[i][0], A[i][1])
cursor.execute(sql)
conn.commit()
i = i + 1
cursor.close
conn.close
`
@woozyking建议的A [i] [1]或'''语法实际上更好。 –
为什么,谢谢。尽管从元的角度来看,if if逻辑匹配人类更好地处理信息的方式。所以这两个都是教育,我更'数字':) – woozyking