Python中__repr__和__str__区别 看下面的例子就明白了 class Test(object): def __init__(self, value='hello, world!'): self.data = value >>> t = Test() >>> t <__main__.Test at 0x7fa91c307190> >>> print t <__main__.Test object at 0x7fa91c3
#encoding:utf-8import os,time#=======================查找手机设备序列号=============a='adb devices'b=os.popen(a).readlines()#print(b)l=[]for sn in b: if 'device' in sn and 'List' not in sn: a=sn.split('\t')[0] l.append(a)print(l) #手机序列号列表#====================