- 博客(10)
- 收藏
- 关注
原创 python找对象
class friend: def init(self,name,sex,facevalue,skill): self.name = name self.sex = sex self.facevalue = facevalue self.skill = skill def goodmorning(self): if self.sex == “女”: print(“老公,早上好”) if self.sex == “男”: print(“老婆,早上好”) boyfriend = friend(“欧豪”,“男”,
2021-01-08 13:22:47
198
原创 python画玫瑰
import turtle import time 设置初始位置 me=input(‘请输入要表白的话及人:\n’) turtle.penup() turtle.left(90) turtle.fd(200) turtle.pendown() turtle.right(90) 花蕊 turtle.fillcolor(“red”) turtle.begin_fill() turtle.circle(10, 180) turtle.circle(25, 110) turtle.left(50) turtle.c
2021-01-08 13:15:59
166
原创 python大富翁
初始化各种模块 import pygame import random import sys 定义类 class Player(): def init(self, image, name, isPlayer): self.name = name self.money = 10000 self.isGoingToMove = False self.movable = True self.image = image self.position = 0 self.temp_position = False sel
2021-01-08 13:14:36
686
1
原创 python豆瓣top250爬虫
from urllib import request from lxml import etree #构造函数,抓取第i页信息 def crow(i): # 构造第i页的网址 url=‘https://movie.douban.com/top250?start=’+str(25i) # 发送请求,获得返回的html代码并保存在变量html中 html=request.urlopen(url).read().decode(‘utf-8’) #将返回的字符串格式的html代码转换成xpath能处理的对象 h
2021-01-08 13:02:17
177
原创 python九九乘法表
or i in range(1, 10): for j in range(1, i+1): print("%d * %d = %d \t" % (i, j, i*j), end=’’) print()
2021-01-08 12:58:17
126
原创 python小黑屋
import random import time EVENT = [“衣衫褴褛的人”,“沼泽”,“xxx”]#事件列表 SOURCE = [“木材”,“肉”,“布”]#资源列表 SKILL = [“降龙十八掌”,“打狗棒法”,“九阴白骨爪”,“九阴真经”,“如来神掌”]#技能列表 def Init():#初始人物 person = {“HP”:100, “Hungry”:100, “IQ”:100, “skill”:"", “木材”:1, “fire”:0}#人的初始状态 time.sleep(2)#停止
2021-01-08 12:43:56
142
原创 假人配对
coding:UTF-8 from random import random, choices, randint ‘’’ #为假人随机选择城市 name = ‘‘黄崇玲、张宛真、刘敏修、林雅惠、杨贞苹、黄武行、白建宏、张仲兰、倪佳蓉、王定辰、许士杰、王佳仪、王名吟、张威宇、吴彦翔、吴美淑、王诗映、许育莲、许菁美、施怡君、高英杰、黄崇妹、林静龙、姚辛南、范乔凯、潘志明、陈志伟、黄俊嘉、王琬兴、卢淑卿、李欣新、洪伟哲、王玉玲、吴佳芷、张翠珊、钱辰宏、郑雅宇、张巧莹、林琬婷、王美虹、贝燕贵、蔡婉琬、陈志伟、孙思洁
2021-01-05 21:47:25
1050
原创 python反恐精英
class Player(object): “”“玩家类”"" def __init__(self, name, hp=100): """初始化玩家属性""" self.name = name # 名字 self.hp = hp # 血量 self.gun = None # 枪 def __str__(self): """返回玩家描述信息""" if self.hp <= 0: return '%s 已经死翘翘了
2021-01-04 22:50:10
550
1
原创 python字典攻击
import itertools # 迭代器 import datetime import hashlib import time def generatelibary(library, length=8): libararys = itertools.product(library,repeat=length) dic = open(“paswordlirbarys.txt”,“w”,encoding=‘utf-8’)#写模式打开文件 for i in libararys: dic.writelines(
2021-01-04 22:44:51
141
原创 python-登录与注册
-- coding:utf-8 -- import sys import pymysql 连接数据库 conn = pymysql.connect(“Mysql主机”, “Mysql用户”, “用户密码”, “数据库名”) cur = conn.cursor() 新增用户数据写入 def db_insert_user(username, password): sql = “insert into user (username, password) values (’%s’, ‘%s’)” % (userna
2021-01-04 22:20:33
162
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人