当然可以现查,但难免落入造轮子的悲剧;kengchi kengchi在那搞了半天,
后来发现内置的就有...
1.字符串
>>> ‘a‘.zfill(3) ‘00a‘ >>> ‘abdef‘.partition(‘b‘) (‘a‘, ‘b‘, ‘def‘) >>> ‘abdef‘.rpartition(‘b‘) (‘a‘, ‘b‘, ‘def‘) >>> ‘a‘.center(10,‘*‘) ‘****a*****‘ >>> tmp="""abc def def defef fff s""" >>> tmp.splitlines() #读文件后干过很多次 splinline(‘\r\n‘) [‘abc def‘, ‘def‘, ‘defef fff \t\ts‘] >>> ‘sd\td‘.expandtabs() ‘sd d‘
时间: 2024-12-07 10:06:32