码迷,mamicode.com
首页 > 其他好文 > 详细

map

时间:2017-07-10 22:22:55      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:pen   join   int   end   app   str   name   pre   map   

def order():
sentence = "is2 Thi1s T4est 3a"
senList = str.split(sentence)
nums = list(range(1, 10))
nums = map(str, nums)
nums = list(nums)
position = []
for item in senList:
for i in nums:
if i in item:
position.append(i)
print(position)
position = list(map(int, position)) #将position里面的值转换成int
print(position)
for i in range(0, len(position)-1):
for j in range(i+1, len(position)):
if position[i] > position[j]:
tem = position[i]
position[i] = position[j]
position[j] = tem
tem = senList[i]
senList[i] = senList[j]
senList[j] = tem
print(‘ ‘.join(senList))


if __name__ == ‘__main__‘:
order()

map

标签:pen   join   int   end   app   str   name   pre   map   

原文地址:http://www.cnblogs.com/sayHello2World/p/7147639.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!