# -*- coding: utf-8 -*-
# -*- coding: gbk -*-
import pandas as pd
import numpy as np
import sys
import re
import os
script_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(script_dir ) # change to the path that you already know
# dfclient = pd.read_excel(u"ClientManagerNumber.xlsx")
# print(dfclient)
df = pd.read_excel(u"总表-4.26.xlsm")
for i in range(1,18):
# mask = dfclient[u'序号'] == i
DataRes = df[[ u"客户"]][df[u'编码'] >= ( i * 100 )][df[u'编码'] < (( i + 1) * 100 )][~df[u'客户'].isnull()].drop_duplicates(subset=[u'客户'], keep='first')
if not DataRes.empty:
# print(dfclient[u'姓名'][mask].to_string( index = False))
print(DataRes.to_string(index = False, header = False))
帖子中有一条由 monospace 字体引起的评论。 我使用cmder作为提示,它已经设置了等宽
这篇文章设置了像df.style.set_properties(**{'text-align': 'left'})
这样的选项,但它对我也不起作用。
那么如何在命令行中对齐输出。我想知道为什么测试和 test2 没有对齐?如果我复制excel文件中的test或test2行并将其粘贴为新行 test3 ,例如。 test3行仍未对齐。
这是我的Excel文件link