Commit e8862de7 by BellCodeEditor

save project

parent c2dcc87d
Showing with 11 additions and 26 deletions
import time
class hero:
def __init__(self,name,hp,attack,level):
self.attack = attack
self.hp = hp
self.level = level
self.name = name
def uplevel(self):
self.level = self.level + 1
self.hp = self.hp + 50
self.attack = self.attack + 4
def printdata(self):
print(self.name,"level=",self.level)
print(self.name,"attack=",self.attack)
print(self.name,"hp=",self.hp)
yase = hero("yase",300,21,1)
houyi = hero("houyi",240,24,1)
yase.uplevel()
houyi.uplevel()
yase.printdata()
houyi.printdata()
\ No newline at end of file
file=open(r"C:\Users\Administrator\Desktop\江思pig.txt","w",encoding='utf-8')
file.write('江思pig你个大头鬼深金冰')
file.close()
with open(r"C:\Users\Administrator\Desktop\江思pig.txt","r",encoding='utf-8') as file:
a=file.read()
for data in file:
if '江思pig你个大头鬼深金冰' in data:
print("in it")
data=data.replace('江思pig你个大头鬼深金冰')
new+=date
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment