python str是什么意思 python中有 “按給定的長度分割字符串”,的函數(shù)或方法嗎?
python中有 “按給定的長度分割字符串”,的函數(shù)或方法嗎?沒用理解按大小分割的意思,大概是按指定長度分割吧? 比較直接的方法: # 比如7個字符分割 c =7 s ="asdfaddsfgsdfg
python中有 “按給定的長度分割字符串”,的函數(shù)或方法嗎?
沒用理解按大小分割的意思,大概是按指定長度分割吧? 比較直接的方法: # 比如7個字符分割 c =7 s ="asdfaddsfgsdfgdsfgsdfg" print [s[i:i c] for i in xrange(0,len(s),c)]