自己写的一个抢票加速的Python小程序源码分享-----纯属娱乐

最近这段时间频频看到微信群里发什么 抢票加速,智行、携程、飞猪、美团,对于我这能坐客车就不坐火车的人来说,无所谓靠谱不靠谱

突发奇想的整理了下整个抢票加速的逻辑,写了这个小程序,代码很low,拒绝批评,求点赞表扬

下面是源码,不懂的留言给我

#_author_='LaoHan';
#date: 2019/1/18


import random
import string
class perList(object):
list = []
def __init__(self):
return self.list

class Quna():
speed = 0
def __new__(self):
if self.speed<100:
intno=random.randint(0, 8)#随机生成0到8任意一数字
print('已为好友成功获得%s个加速包' % intno)
self.speed +=intno
print(perList.list)
return perList.list[-1]#返回列表中的最后一个元素
else:
print('已到达VIP急速模式')
#return self.speed

if __name__=='__main__':
i =0
while i<=5:
ran_str = ''.join(random.sample(string.ascii_letters + string.digits, 5))#随机生成字符串给前面变量
if ran_str in perList.list:#判断随机生成的字符串是否已经添加到了列表,如果已添加说明已加速,不允许继续加速
print('%s今日已为好友加速'%ran_str)

else:
print(ran_str)
perList.list.append(ran_str)
perList.list[-1] = Quna()
i += 1


猜你喜欢

转载自www.cnblogs.com/pytest/p/10289515.html