美文网首页
还在微信朋友圈发哀求好友加速抢票?自己写一个就行了不!

还在微信朋友圈发哀求好友加速抢票?自己写一个就行了不!

作者: 919b0c54458f | 来源:发表于2019-01-25 10:31 被阅读32次

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

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

下面是源码,不懂的留言给,加群:960410445 获取哦

-----------------------------程序开始------------------------------------

#_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

-------------------------程序结束,下面是执行结果----------------------

相关文章

网友评论

      本文标题:还在微信朋友圈发哀求好友加速抢票?自己写一个就行了不!

      本文链接:https://www.haomeiwen.com/subject/rvcmjqtx.html