国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

python - 使用executemany入庫產生pymysql.err.ProgrammingError

瀏覽:149日期:2022-08-24 09:50:37

問題描述

錯誤如下:pymysql.err.ProgrammingError: (1064, 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’’2016/12/05’,’0935’,’9.56’,’9.56’,’9.38’,’9.40’,’869500’,’8209314.50n’)’ at line 1')

**插入語句如下:

insert='insert into sz values(%s,%s,%s,%s,%s,%s,%s,%s)'

for f in glob.glob(self.fdir+os.sep+'*.txt'):

ifile=open(f,’r’)for line in ifile: line=line.split('t') linelist.append(line)ifile.close() try:cursor.executemany(insert,linelist) except IndexError:pass

**我是新手,剛開始學python,請問問題出在哪了?

問題解答

回答1:

應該是換行符號的錯誤,因為看到你的錯誤里有’8209313.50n’,從文件取出一行數據你的換行符號每處理,python有標準的讀取一行數據的文件操作方法,

標簽: Python 編程
相關文章:
主站蜘蛛池模板: 岗巴县| 高州市| 渑池县| 左云县| 安吉县| 黔东| 巫溪县| 兴城市| 大石桥市| 济宁市| 孝感市| 石泉县| 东港市| 山阳县| 封丘县| 砀山县| 唐海县| 黄骅市| 阿尔山市| 吴川市| 巩留县| 海口市| 含山县| 寿光市| 阿合奇县| 开化县| 巴塘县| 砀山县| 贡山| 响水县| 福建省| 庆安县| 孙吴县| 固始县| 胶州市| 乌拉特后旗| 惠东县| 乌鲁木齐县| 贵港市| 庆阳市| 吉林市|