iPhone的设备名转换
def convertDeviceName(self, deviceName): """ 转换deviceName(如iPhone 6,2)为用户习惯形式(如iPhone 5s) """ if deviceName == ['iPhone5,1', 'iPhone5,2']: deviceName_new = 'iPhone 5' return deviceName_new elif deviceName in ['iPhone5,3', 'iPhone5,4']: deviceName_new = 'iPhone 5C' return deviceName_new elif deviceName in ['iPhone6,1', 'iPhone6,2']: deviceName_new = 'iPhone 5s' return deviceName_new elif deviceName in ['iPhone7,1']: deviceName_new = 'iPhone 6 Plus' return deviceName_new elif deviceName in ['iPhone7,2']: deviceName_new = 'iPhone 6' return deviceName_new elif deviceName in ['iPhone8,1']: deviceName_new = 'iPhone 6s' return deviceName_new elif deviceName in ['iPhone8,2']: deviceName_new = 'iPhone 6s Plus' return deviceName_new elif deviceName in ['iPhone8,4']: deviceName_new = 'iPhone SE' return deviceName_new elif deviceName in ['iPhone9,1', 'iPhone9,3']: deviceName_new = 'iPhone 7' return deviceName_new elif deviceName in ['iPhone9,2', 'iPhone9,4']: deviceName_new = 'iPhone 7 Plus' return deviceName_new elif deviceName in ['iPhone10,1', 'iPhone10,4']: deviceName_new = 'iPhone 8' return deviceName_new elif deviceName in ['iPhone10,2', 'iPhone10,5']: deviceName_new = 'iPhone 8 Plus' return deviceName_new elif deviceName in ['iPhone10,3', 'iPhone10,6']: deviceName_new = 'iPhone X' return deviceName_new else: raise ValueError(u'未识别的手机版本')
日行一善, 日写一撰