|
2782| 1
|
有关expandtabs方法的用法问题 |
|
2鱼币
最佳答案看了Python的帮助文档:Return a copy of the string where all tab characters are replaced by one or more spaces, depending on the current column and the given tab size.
输出的空格数与\t前面的字符数有关:
>>> a = 'a\tb'
>>> for i in range(15):
... print(a.expandtabs(tabsize=i))
...
tabsize(i) 空格数
ab 0 0
a b 1 1
a b 2 1
a b 3 2
a b 4 3
a b 5 4
a ...
| ||
|
小甲鱼最新课程 -> https://ilovefishc.com
|
||
| ||
|
小甲鱼最新课程 -> https://ilovefishc.com
|
||
小黑屋|手机版|Archiver|鱼C工作室
( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)
GMT+8, 2026-2-25 05:23
Powered by Discuz! X3.4
© 2001-2023 Discuz! Team.