码迷,mamicode.com
首页 > 其他好文 > 详细

iPhone的设备名转换

时间:2018-12-20 19:06:40      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:iphone 5   erro   形式   def   value   color   设备   iphone8   return   

 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未识别的手机版本)

 

iPhone的设备名转换

标签:iphone 5   erro   形式   def   value   color   设备   iphone8   return   

原文地址:https://www.cnblogs.com/xiyuan2016/p/10150484.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!