Commit 7b9f00da by BellCodeEditor

auto save

parent 0816144b
# 神奇百货中的物品已经帮你创建好啦,接下来要看你的了~
dict= {'可口可乐':3,'旺仔牛奶':4,'农夫山泉':1,'辣条':3,'巴西烤肉':2,'果冻':4,'乐事':5,'奥利奥':10,'巧克力':6}
j=input("你要买什么?")
if j in dict:
num=input("你要买多少:")
print('购买',num,'个',j,'需要',int(num)*dict[j],'元。')
else:
print("我不卖给你")
\ No newline at end of file
# # 神奇百货中的物品已经帮你创建好啦,接下来要看你的了~
# dict= {'可口可乐':3,'旺仔牛奶':4,'农夫山泉':1,'辣条':3,'巴西烤肉':2,'果冻':4,'乐事':5,'奥利奥':10,'巧克力':6}
# j=input("你要买什么?")
# if j in dict:
# num=input("你要买多少:")
# print('购买',num,'个',j,'需要',int(num)*dict[j],'元。')
# else:
# print("我不卖给你")
text='bellcode'
# for i in text:
# print(i)
print(text[4:])
\ No newline at end of file
# class BigDog:
# def __init__(self,color):
# self.leg=4
# self.eye=2
# self.color=color
# xiaohei=BigDog('black')
# print(xiaohei.color)
class Cat():
def __init__(self,type,color,price):
self.foot=4
self.type=type
self.color=color
self.price=price
def seyprice(self,):
print('价格为',self.price)
many=Cat('波斯猫',"oran",430)
many.seyprice()
\ No newline at end of file
with open(r'C:\Users\admin\Desktop\book.txt','w',encoding='utf-8')as file:
file.write(' 锦瑟\n [唐] 李商隐\n 锦瑟无端五十弦,\n 一弦一柱思华年。\n 庄生晓梦迷蝴蝶,\n 望帝春心托杜鹃。\n 沧海月明珠有泪,\n 蓝田日暖玉生烟。\n 此情可待成追忆,\n 只是当时已惘然。')
new_file=''
with open(r'C:\Users\admin\Desktop\book.txt','r',encoding='utf-8')as file:
for data in file:
if '蓝田日暖玉生烟' in data:
data=data.replace('蓝田日暖玉生烟','_______________')
if '此情可待成追忆' in data:
data=data.replace('此情可待成追忆','_______________')
new_file+=data
with open(r'C:\Users\admin\Desktop\book.txt','w',encoding='utf-8')as file:
file.write(new_file)
\ No newline at end of file
# class Dog:
# def __init__(self,color):
# self.leg=4
# self.eye=2
# self.color=color
# xiaobai=Dog('black')
# print(xiaobai.color)
class Cat:
def __init__(self,type,color,price):
self.foot=4
self.type=type
self.color=color
self.price=price
def sayPrice(self):
print(self.price)
mao=Cat('加菲猫','black',200)
mao.sayPrice()
\ No newline at end of file
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