2017年8月17日

用python将字符串转成list类型

摘要: # -*- coding=UTF-8 -*- list=[] strs="'[108,1873]'" #去除字符串两边的字符 s=strs.strip("'[]'") print s #以逗号拆分字符串,并逐一添加到list中 a=int(s.split(',')[0]) b=int(s.split(',')[1]) list.append(a) list.append(b) print lis... 阅读全文

posted @ 2017-08-17 15:44 Hamioo 阅读(1276) 评论(0) 推荐(0)

导航