import random import itchat def randomRed(): red = [] while len(red)!=6: redtemp = random.randint(1,33) if redtemp not in red: red.append(redtemp) else: continue return red def randomBlue(): return random.randint(1,12) def get500Wkey(): red = randomRed() blue = randomBlue() print("red: %d %d %d %d %d %d"%(red[0],red[1],red[2],red[3],red[4],red[5])) print("blue: %d"%(blue)) result = "红球: %d %d %d %d %d %d"%(red[0],red[1],red[2],red[3],red[4],red[5])+" "+"篮球: %d"%(blue) return result def send_wechat(): itchat.login() res = itchat.send("随机一注: "+get500Wkey(),"@@001b263f5f2db50fa71f502f2954da6") print(res) friends = itchat.get_chatrooms() # friends = itchat.get_friends() print(friends) # itchat.logout() if __name__ == '__main__': send_wechat()