比如 cur.execute(copy talbe from test.txt)?这个怎么知道 copy 了多少 line 呢? 另外就是想按照分节符把一行拆开,然后 insert 到数据库,如何优雅得去掉行尾得换行符? strip ?貌似有帖子说如果是中文,会有 bug 存在。 大神赐教哈,感觉没法把 python 写的简练。
比如 cur.execute(copy talbe from test.txt)?这个怎么知道 copy 了多少 line 呢? 另外就是想按照分节符把一行拆开,然后 insert 到数据库,如何优雅得去掉行尾得换行符? strip ?貌似有帖子说如果是中文,会有 bug 存在。 大神赐教哈,感觉没法把 python 写的简练。
1
qile1 May 1, 2018 via Android
优雅不知道,我都是 str.replac (“ ”,“”).replac (“\r “,””)加一堆
|
3
Yycreater May 7, 2018
cursor.rowcount()这个,查看受影响的行数
|