>>> s = 'sdfsffoeos919340-sdjanmzxcejf3adkadiiwadasdasdasd221'
>>> print('\n'.join(s[i:i+5] for i in range(0,len(s),5)))
sdfsf
foeos
91934
0-sdj
anmzx
cejf3
adkad
iiwad
asdas
dasd2
21
>>>
>>> s = 'sdfsffoeos919340-sdjanmzxcejf3adkadiiwadasdasdasd221'
>>> print('\n'.join(s[i:i+5] for i in range(0,len(s),5)))
sdfsf
foeos
91934
0-sdj
anmzx
cejf3
adkad
iiwad
asdas
dasd2
21
>>>
本文标题:python实现一串字符串快速换行
本文链接:https://www.haomeiwen.com/subject/tkvrlqtx.html
网友评论