odoo 学习


1.2.3.4
1.2.5.6
2.4
10.6
变成1.234,1.256,2.4,10.6

def get_bom_namenum(self, cr, uid, ids, field_name, arg, context=None): rvalue={} for obj in self.browse(cr,uid,ids,context=None): firstnum='' centernum='' endnum=0.0 for i in range(len(obj.name.split('.'))): if i==0: firstnum=obj.name.split('.')[0]+'.' else: centernum+=obj.name.split('.')[i] endnum=firstnum+centernum rvalue[obj.id]=float(endnum) return rvalue
list1=[1.22222,2.3333,3.2222,3.14145,2.025]
sorted(list1)
print sorted(list1)
[1.22222, 2.025, 2.3333, 3.14145, 3.2222]

 

posted @ 2018-04-13 16:32  何双新  阅读(174)  评论(0编辑  收藏  举报