python 有没有函数可以把字符串每两个字符一组变成列表
3 回答
![?](http://img1.sycdn.imooc.com/545868190001d52602200220-100-100.jpg)
慕桂英4014372
TA贡献1871条经验 获得超13个赞
python
123456 | x = '1234567' n = len (x) l = [x[i - 1 ] + x[i] for i in range (n) if i % 2 ! = 0 ] if n % 2 ! = 0 : l.append(x[ - 1 ]) print (l) |
添加回答
举报
0/150
提交
取消