标签:text ids elf 3.4 menu row class oat 3.2
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]
标签:text ids elf 3.4 menu row class oat 3.2
原文地址:https://www.cnblogs.com/1314520xh/p/8821422.html