[英]python : align query result
how do I align all the values in the middle of the query result? 如何在查询结果中间对齐所有值?
print('\n\nThis is my first Query in Python\n')
print(tabulate(cursor, showindex=False, headers=cursor.columns))
this is the result: 结果是:
Use numalign
argument, like this: 使用
numalign
参数,如下所示:
print('\n\nThis is my first Query in Python\n')
print(tabulate(cursor, showindex=False, headers=cursor.columns, numalign='center'))
前段时间有人问过同样的问题: 漂亮地打印一个熊猫数据框,我建议你看看最后一个答案,也可以尝试使用制表函数: tablefmt='psql'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.