data_generator.py 文件源码

python
阅读 55 收藏 0 点赞 0 评论 0

项目:py_exercise 作者: GoverSky 项目源码 文件源码
def id(self, state=False):
        # ???????????
        distcode = self.dist_code
        id = distcode['code']  # 6????
        id += str(randint(1930, 2017))  # ??????
        da = date.today() + timedelta(days=randint(1, 366))  # ??????
        id += da.strftime('%m%d')  # ??????
        id += str(randint(100, 999))  # ????
        count = 0
        weight = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]  # ???
        checkcode = {'0': '1', '1': '0', '2': 'X', '3': '9', '4': '8', '5': '7', '6': '6', '7': '5', '8': '5', '9': '3',
                     '10': '2'}  # ???????
        for i in range(0, len(id)):
            count = count + int(id[i]) * weight[i]
        id += checkcode[str(count % 11)]  # ???????
        if state:
            return {'state': distcode['state'], 'id': id}
        else:
            return id
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号