如何使用python格式化SQLite3中的列宽?
我的数据库中的文件路径列被切断,我还没有找到任何说明如何在python中指定列宽的文档。我目前正在使用熊猫打印终端中的数据库 数据库打印输出:如何使用python格式化SQLite3中的列宽?,python,pandas,sqlite,Python,Pandas,Sqlite,我的数据库中的文件路径列被切断,我还没有找到任何说明如何在python中指定列宽的文档。我目前正在使用熊猫打印终端中的数据库 数据库打印输出: Path Status Time 0 pytest_file.c Safe 2018-06-11 10:33:29 1 /
Path Status Time
0 pytest_file.c Safe 2018-06-11 10:33:29
1 /Users/me/Documents/to_scan/SSpres... File Sent 2018-06-11 10:45:05
2 /Users/me/Downloads/SampleData/Eli... File Sent 2018-06-11 10:45:33
3 /Users/me/Downloads/SampleData/Eli... File Sent 2018-06-11 10:45:34
4 /Users/me/Downloads/SampleData/Lec... File Sent 2018-06-11 10:45:35
5 /Users/me/temp/ess-dive-volumes/var... Safe 2018-06-11 11:46:02
6 /Users/me/temp/ess-dive-volumes/var... Safe 2018-06-11 11:46:18
7 /Users/me/temp/ess-dive-volumes/var... Safe 2018-06-11 11:46:34
8 /Users/me/temp/ess-dive-volumes/var... Safe 2018-06-11 11:46:50
用于打印数据库的代码:
con = sqlite3.connect(data_base)
return pd.read_sql_query('''SELECT Path, Status, Time FROM files_db''', con)
print(print_db(database))
事实证明,熊猫是限制因素,而不是限制因素3。我通过手动将
pd.options.display.max\u colwidth
设置为255
解决了这个问题
解决这个问题的一行代码:
pd.options.display.max_colwidth = 255
嘿,看看这个
https://stackoverflow.com/q/1751189/8150371
我通读了这篇文章。看起来他们在使用unix命令。我正在寻找一个可以在python中使用的解决方案。我也没有使用.width命令(我认为它不存在于sqlite3 python库中)。