![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
林志辉linzh
stay curious
展开
-
A byte of python笔记
5.6三引号字符串''' '''(多行字符串)5.7 \ 需要说明的是,在一个字符串中,在一行末尾的反斜杠仅仅表示下一行的字符串是上一行的继续。,但并不增加新的行。例如:1 "This is the first sentence.\2 This is the second sentence."与 "This is the first sentence. This is原创 2017-09-03 16:10:57 · 236 阅读 · 0 评论 -
python字符串format中英文空格对齐问题
print('{:^10}\t{:^10}\t{:^10}'.format(u[0], u[1], u[2]))很明显,第二三列字符串并没有对齐。原因:当中文字符宽度不够时,采用西文字符填充;中西文字符占用宽度不同解决方案:采用中文字符空格填充, (utf-8编码)chr(12288) 改造:tplt = '{0:^10}\t{1:{3}^10}\t{2:^原创 2017-09-05 17:39:18 · 7051 阅读 · 1 评论