Signed-off-by: 10_2 <sairate@sina.cn>
This commit is contained in:
parent
0e69a996f8
commit
ea1a060252
|
@ -0,0 +1,3 @@
|
|||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.12 (liutianshuo)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.12 (liutianshuo)" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (liutianshuo)" project-jdk-type="Python SDK" />
|
||||
</project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/liutianshuo.iml" filepath="$PROJECT_DIR$/.idea/liutianshuo.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,10 @@
|
|||
a=int(input("半径是:"))
|
||||
class circle():
|
||||
def __init__(self,r):
|
||||
self.r=r
|
||||
|
||||
def cir(self):
|
||||
print('周长是:',3.14159265358979323846*self.r*2)
|
||||
print('面积是:',3.14159265358979323846*self.r**2)
|
||||
circle1=circle(a)
|
||||
circle1.cir()
|
|
@ -0,0 +1,4 @@
|
|||
def say_hello(x):
|
||||
print("hello",x)
|
||||
return
|
||||
say_hello(input())
|
|
@ -0,0 +1,10 @@
|
|||
def is_san(c,d,e):
|
||||
if c+d>e and c+d>e and c+d>e:
|
||||
print('yes')
|
||||
else:
|
||||
print('no')
|
||||
|
||||
a=int(input())
|
||||
b=int(input())
|
||||
c=int(input())
|
||||
is_san(a,b,c)
|
|
@ -0,0 +1,11 @@
|
|||
class student():
|
||||
def __init__(self,a):
|
||||
self.a=a
|
||||
print(student.__class__)
|
||||
a=2
|
||||
print(a.__class__)
|
||||
str="python"
|
||||
print(str.__class__)
|
||||
class person:
|
||||
pass
|
||||
print(person.__doc__)
|
|
@ -0,0 +1,5 @@
|
|||
n=int(input())
|
||||
sum=0
|
||||
for i in range(n):
|
||||
sum+=int(input())
|
||||
print('%.2f'%(sum/n))
|
|
@ -0,0 +1,5 @@
|
|||
n=int(input())
|
||||
sum=0
|
||||
for i in range(1,n+1):
|
||||
sum=sum+i
|
||||
print(sum)
|
|
@ -0,0 +1,12 @@
|
|||
class Person(object):
|
||||
def __init__(self,name,age,birthday,sex):
|
||||
self.name = name
|
||||
self.age = age
|
||||
self.birthday = birthday
|
||||
self.sex=sex
|
||||
person=Person("xm","18","10月8日","女")
|
||||
print(person.__dict__)
|
||||
print(Person.__dict__)
|
||||
print(dir(Person))
|
||||
print(type(Person),type(person))
|
||||
print(Person.__class__,person.__class__)
|
|
@ -0,0 +1,18 @@
|
|||
class ticket:
|
||||
def __init__(self,weekend=False,child=False,):
|
||||
self.exp=100
|
||||
if weekend:
|
||||
self.inc=1.2
|
||||
else:
|
||||
self.inc=1
|
||||
if child:
|
||||
self.discount=0.5
|
||||
else:
|
||||
self.discount=1
|
||||
def calc(self,num):
|
||||
P=self.exp*self.inc*self.discount*num
|
||||
return P
|
||||
|
||||
adult=ticket()
|
||||
child=ticket(child=True)
|
||||
print("2个成人+1个小孩平日票价为:%.2f"%(adult.calc(2)+child.calc(1)))
|
|
@ -0,0 +1,2 @@
|
|||
n=int(input())
|
||||
print(round(2+(n-1)*0.8))
|
|
@ -0,0 +1,10 @@
|
|||
n=int(input("请输入借书天数"))
|
||||
s=0
|
||||
if n<1:
|
||||
print("您输入的借书天数有错")
|
||||
else:
|
||||
if n==1:
|
||||
s=2
|
||||
else:
|
||||
s=2+(n-1)*0.8
|
||||
print(round(s),"元")
|
|
@ -0,0 +1,6 @@
|
|||
n=1
|
||||
while True:
|
||||
if n%9==7 and n%5==2 and n%4==1:
|
||||
print(n)
|
||||
break
|
||||
n+=1
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
def sort(arr):
|
||||
if len(arr)<=1:
|
||||
return arr
|
||||
base=arr[0]
|
||||
left=[i for i in arr[1:]if i<=base]
|
||||
right=[i for i in arr[1:] if i > base]
|
||||
return sort(left)+[base]+sort(right)
|
||||
print(sort([23,4332,44,6,43,423,5,4,64,35,34,54,576,56,36,57,587,46,6,5,75,]))
|
|
@ -0,0 +1,123 @@
|
|||
students={"张三":{"name":"张三",
|
||||
"ID":202001,
|
||||
"语文":89,
|
||||
"数学":97,
|
||||
"英语":91
|
||||
},
|
||||
"李四":{"name":"李四",
|
||||
"ID":202002,
|
||||
"语文":97,
|
||||
"数学":81,
|
||||
"英语":90
|
||||
},
|
||||
"王五": {"name": "王五",
|
||||
"ID": 202003,
|
||||
"语文": 97,
|
||||
"数学": 100,
|
||||
"英语": 94
|
||||
},
|
||||
"赵六": {"name": "赵六",
|
||||
"ID": 202004,
|
||||
"语文": 81,
|
||||
"数学": 92,
|
||||
"英语": 73
|
||||
}
|
||||
}
|
||||
|
||||
def showinfo():
|
||||
print("-"*110)
|
||||
print(''' 学生成绩系统
|
||||
1.添加学生信息
|
||||
2.删除学生信息
|
||||
3.修改学生信息
|
||||
4.查询学生信息
|
||||
5.学生成绩排序
|
||||
6.列出所有学生信息
|
||||
7.退出程序''')
|
||||
print("-"*110)
|
||||
def paixu(a,b):
|
||||
return [name for name in students.keys()if students[name][a]>=b]
|
||||
c=0
|
||||
while True:
|
||||
showinfo()
|
||||
choice=input("请输入你的选择:")
|
||||
if choice=="1":
|
||||
id=int(input("要添加的学生的ID:"))
|
||||
c=0
|
||||
for i in students:
|
||||
if id==students[i]["ID"]:
|
||||
c=1
|
||||
break
|
||||
if c==1:
|
||||
print("学生已在列表中")
|
||||
else:
|
||||
d1=input("学生姓名:")
|
||||
|
||||
|
||||
students[d1]={
|
||||
"name": d1,
|
||||
"ID": id,
|
||||
"语文": int(input("语文成绩:")),
|
||||
"数学": int(input("数学成绩:")),
|
||||
"英语": int(input("英语成绩:"))
|
||||
}
|
||||
elif choice=="2":
|
||||
id = int(input("要删除的学生的ID:"))
|
||||
c = 0
|
||||
for i in students:
|
||||
if id == students[i]["ID"]:
|
||||
c = 1
|
||||
break
|
||||
if c == 1:
|
||||
print("学生没在列表中")
|
||||
else:
|
||||
d1 = input("学生姓名:")
|
||||
del students[d1]
|
||||
elif choice=="3":
|
||||
id = int(input("要修改的学生的ID:"))
|
||||
c = 0
|
||||
d=0
|
||||
for i in students:
|
||||
d=i
|
||||
if id == students[i]["ID"]:
|
||||
c = 1
|
||||
break
|
||||
if c:
|
||||
del students[d]
|
||||
d1 = input("学生姓名:")
|
||||
students[d1] = {
|
||||
"name": d1,
|
||||
"ID": id,
|
||||
"语文": int(input("语文成绩:")),
|
||||
"数学": int(input("数学成绩:")),
|
||||
"英语": int(input("英语成绩:"))
|
||||
}
|
||||
else:
|
||||
print("不在列表")
|
||||
|
||||
elif choice=="4":
|
||||
id = int(input("要查询的学生的ID:"))
|
||||
|
||||
for i in students:
|
||||
|
||||
if id == students[i]["ID"]:
|
||||
|
||||
c = 1
|
||||
break
|
||||
if c == 1:
|
||||
print("学生没在列表中")
|
||||
else:
|
||||
d1 = input("学生姓名:")
|
||||
print(d1,students[d1])
|
||||
elif choice=="5":
|
||||
a=input("学科:")
|
||||
b=int(input("筛选成绩:"))
|
||||
print(paixu(a,b))
|
||||
elif choice=="6":
|
||||
for i in students:
|
||||
print(i,students[i])
|
||||
elif choice=="7":
|
||||
print("退出程序")
|
||||
break
|
||||
else:
|
||||
print("无效输入,请重新输入")
|
|
@ -0,0 +1,56 @@
|
|||
value=input().split()
|
||||
n,m,k=int(value[0]),int(value[1]),int(value[2])
|
||||
b=[]
|
||||
for i in range(n):
|
||||
temp = []
|
||||
for j in range(n):
|
||||
temp.append(0)
|
||||
b.append(temp)
|
||||
def zuobiao(x1,y1):
|
||||
if 0<=x1<=n-1 and 0<=y1<=n-1:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
def huo(x,y):
|
||||
heng=x-2
|
||||
for i in range(heng,heng+5):
|
||||
temp= zuobiao(i,y)
|
||||
if temp:
|
||||
b[i][y] = 1
|
||||
|
||||
lie=y-2
|
||||
for i in range(lie,lie+5):
|
||||
temp= zuobiao(x,i)
|
||||
if temp:
|
||||
b[x][i] = 1
|
||||
|
||||
listx=[x-1,x+1]
|
||||
listy=[y-1,y+1]
|
||||
for i in listx:
|
||||
for j in listy:
|
||||
temp= zuobiao(i,j)
|
||||
if temp:
|
||||
b[i][j] = 1
|
||||
|
||||
def yingshi(x,y):
|
||||
heng=x-2
|
||||
lie=y-2
|
||||
for i in range(heng,heng+5):
|
||||
for j in range(lie,lie+5):
|
||||
temp= zuobiao(i,j)
|
||||
if temp:
|
||||
b[i][j] = 1
|
||||
for i in range(m):
|
||||
x1,y1=map(int,input().split())
|
||||
huo(x1-1,y1-1)
|
||||
for i in range(k):
|
||||
x2,y2=map(int,input().split())
|
||||
yingshi(x2-1,y2-1)
|
||||
count=0
|
||||
for i in range(n):
|
||||
for j in range(n):
|
||||
print(b[i][j],end=' ')
|
||||
if b[i][j]==0:
|
||||
count+=1
|
||||
print()
|
||||
print(count)
|
|
@ -0,0 +1,23 @@
|
|||
def g(n,start,a,b):
|
||||
if sum(a)==n:
|
||||
b.append(a[:])
|
||||
return
|
||||
|
||||
for i in range(start,n+1):
|
||||
if sum(a)+i>n:
|
||||
break
|
||||
a.append(i)
|
||||
g(n,i,a,b)
|
||||
a.pop()
|
||||
|
||||
def p(n):
|
||||
b=[]
|
||||
g(n,1,[],b)
|
||||
b.sort()
|
||||
for r in b:
|
||||
print(" ".join(map(str,r)))
|
||||
|
||||
n=int(input())
|
||||
p(n)
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
a=int(input())
|
||||
for i in range(1,a+1):
|
||||
u=[] #失败
|
||||
u.append(i)
|
||||
if sum(u) == a:
|
||||
print(u)
|
||||
for j in range(1, a + 1):
|
||||
u.append(j)
|
||||
if sum(u) == a:
|
||||
print(u)
|
||||
for k in range(1, a + 1):
|
||||
u.append(k)
|
||||
if sum(u) == a:
|
||||
print(u)
|
||||
for b in range(1, a + 1):
|
||||
u.append(b)
|
||||
if sum(u) == a:
|
||||
print(u)
|
||||
for y in range(1, a + 1):
|
||||
u.append(y)
|
||||
if sum(u) == a:
|
||||
print(u)
|
||||
u.pop()
|
||||
u.pop()
|
||||
u.pop()
|
||||
u.pop()
|
||||
u.pop()
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
def g(n,start,a,b):
|
||||
if sum(a)==n:
|
||||
b.append(a[:])
|
||||
return
|
||||
|
||||
for i in range(1,n+1):
|
||||
if sum(a)+i>n:
|
||||
break
|
||||
a.append(i)
|
||||
g(n,i,a,b)
|
||||
a.pop()
|
||||
|
||||
def p(n):
|
||||
b=[]
|
||||
g(n,1,[],b)
|
||||
b.sort()
|
||||
for r in b:
|
||||
print(" ".join(map(str,r)))
|
||||
|
||||
n=int(input())
|
||||
p(n)
|
||||
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
import turtle
|
||||
import random
|
||||
t=turtle.Turtle()
|
||||
|
||||
t.speed(0)
|
||||
|
||||
def lian(x, y):
|
||||
t.penup()
|
||||
t.goto(x, y)
|
||||
t.pendown()
|
||||
t.fillcolor("yellow")
|
||||
t.begin_fill()
|
||||
t.circle(35)
|
||||
t.end_fill()
|
||||
|
||||
def eyes(x27,y5):
|
||||
t.penup()
|
||||
t.goto(x27,y5)
|
||||
t.pendown()
|
||||
t.fillcolor("black")
|
||||
t.begin_fill()
|
||||
t.circle(6)
|
||||
t.end_fill()
|
||||
|
||||
t.penup()
|
||||
t.goto(x27, y5+4)
|
||||
t.pendown()
|
||||
t.fillcolor("white")
|
||||
t.begin_fill()
|
||||
t.circle(2)
|
||||
t.end_fill()
|
||||
|
||||
def zui(x,y):
|
||||
t.penup()
|
||||
t.goto(x,y)
|
||||
t.pendown()
|
||||
t.setheading(-45)
|
||||
t.circle(radius=40, extent=90, steps=4) #circle(radius=50,extent=80,steps=5)
|
||||
|
||||
def smile(x,y):
|
||||
lian(x,y)
|
||||
eyes(x+17,y+40)
|
||||
eyes(x -17, y + 40)
|
||||
zui(x-25,y+26)
|
||||
t.setheading(0)
|
||||
|
||||
for i in range(1000):
|
||||
y = random.randint(-7, 7) * 70
|
||||
x = random.randint(-6, 6) * 70
|
||||
smile(x,y)
|
||||
t.hideturtle()
|
||||
turtle.done()
|
|
@ -0,0 +1,31 @@
|
|||
import tkinter
|
||||
from PIL import Image,ImageTk
|
||||
from tkinter import filedialog
|
||||
import os
|
||||
from amzqr import amzqr
|
||||
tk=tkinter.Tk()
|
||||
tk.geometry("400x400")
|
||||
tk.resizable(0,0)
|
||||
bg_image=Image.open("qrcode_bg.jpg")
|
||||
bg_image=ImageTk.PhotoImage(bg_image)
|
||||
bg_label=tkinter.Label(tk,image=bg_image)
|
||||
bg_label.pack()
|
||||
text1=tkinter.Text(tk,font=("华文行楷",12),width=30,height=5)
|
||||
text1.place(x=80,y=100)
|
||||
text2=tkinter.Text(tk,font=("华文行楷",12),width=23,height=1)
|
||||
text2.place(x=80,y=250)
|
||||
def get_pic():
|
||||
pic_path=filedialog.askopenfilename()
|
||||
text2.delete("1.0","end")
|
||||
text2.insert("1.0",pic_path)
|
||||
btn2=tkinter.Button(tk,text="浏览",font=("华文行楷",12),command=get_pic)
|
||||
btn2.place(x=312,y=250,height=25)
|
||||
def qr():
|
||||
word=text1.get("1.0","end")
|
||||
word="".join(word.split("\n"))
|
||||
picture=text2.get("1.0","end")[:-1]
|
||||
version,level,qr_name=amzqr.run(words=word,picture=picture,colorized=True)
|
||||
os.system(qr_name)
|
||||
btn1=tkinter.Button(tk,text="生成二维码",font=("华文行楷",15),command=qr)
|
||||
btn1.place(x=80,y=300,width=250)
|
||||
tk.mainloop()
|
|
@ -0,0 +1,25 @@
|
|||
import tkinter as tk
|
||||
import random
|
||||
import threading
|
||||
import time
|
||||
from PIL import Image,ImageTk
|
||||
from pygame.examples.cursors import image
|
||||
|
||||
from 二维码生成器 import text_input
|
||||
|
||||
|
||||
class MovingLabel(threading.Thread):
|
||||
def __init__(self,window,text):
|
||||
threading.Thread.__init__(self)
|
||||
self.text=text
|
||||
self.label=tk.label(window,image=kuang,text=self.text,compound="center",font=("黑体",20),fg="white",width=190,height=45)
|
||||
self.label.place(x=800,y=random.randint(10,550))
|
||||
def run(self):
|
||||
x=800
|
||||
while x>-200:
|
||||
x-=2
|
||||
self.label.place(x=x)
|
||||
time.sleep(0.02)
|
||||
self.label.destroy()
|
||||
def send():
|
||||
text=e1.get()
|
Binary file not shown.
After Width: | Height: | Size: 771 KiB |
Binary file not shown.
After Width: | Height: | Size: 508 KiB |
|
@ -0,0 +1,116 @@
|
|||
import tkinter as tk
|
||||
from tkinter import filedialog, messagebox
|
||||
import qrcode
|
||||
from PIL import Image
|
||||
|
||||
|
||||
# 生成二维码的函数
|
||||
def generate_qr():
|
||||
text = text_input.get("1.0", tk.END).strip() # 获取用户输入的文字
|
||||
if not text:
|
||||
messagebox.showerror("错误", "请输入内容!")
|
||||
return
|
||||
|
||||
# 选择保存路径
|
||||
save_path = filedialog.asksaveasfilename(
|
||||
defaultextension=".png",
|
||||
filetypes=[("PNG 图片", "*.png"), ("所有文件", "*.*")]
|
||||
)
|
||||
if not save_path:
|
||||
return # 用户取消保存时退出
|
||||
|
||||
try:
|
||||
# 调用 qrcode 库生成二维码
|
||||
qr = qrcode.QRCode(
|
||||
version=1, # 控制二维码大小,1~40
|
||||
error_correction=qrcode.constants.ERROR_CORRECT_H, # 容错率,可选 L, M, Q, H
|
||||
box_size=10, # 每个模块的像素大小
|
||||
border=4, # 边框宽度(模块单位)
|
||||
)
|
||||
qr.add_data(text) # 添加内容
|
||||
qr.make(fit=True) # 适配大小
|
||||
|
||||
# 生成二维码图片
|
||||
qr_img = qr.make_image(fill_color="black", back_color="white").convert("RGBA")
|
||||
|
||||
# 将二维码中的白色背景透明化
|
||||
qr_img = make_background_transparent(qr_img)
|
||||
|
||||
# 如果选择了背景图片,将其融合到二维码中
|
||||
if bg_image_path.get():
|
||||
bg_img = Image.open(bg_image_path.get()).convert("RGBA")
|
||||
qr_img = blend_qr_with_bg(qr_img, bg_img)
|
||||
|
||||
qr_img.save(save_path) # 保存图片
|
||||
messagebox.showinfo("成功", f"二维码已生成并保存至:\n{save_path}")
|
||||
except Exception as e:
|
||||
messagebox.showerror("错误", f"生成二维码失败:\n{e}")
|
||||
|
||||
|
||||
# 选择背景图片的函数
|
||||
def select_bg_image():
|
||||
file_path = filedialog.askopenfilename(
|
||||
filetypes=[("图片文件", "*.png;*.jpg;*.jpeg"), ("所有文件", "*.*")]
|
||||
)
|
||||
if file_path:
|
||||
bg_image_path.set(file_path)
|
||||
bg_label.config(text=f"已选择背景图片:{file_path}")
|
||||
|
||||
|
||||
# 将二维码和背景图片融合的函数
|
||||
def blend_qr_with_bg(qr_img, bg_img):
|
||||
# 调整背景图片大小与二维码一致
|
||||
bg_img = bg_img.resize(qr_img.size, Image.Resampling.LANCZOS)
|
||||
|
||||
# 将二维码与背景图片融合
|
||||
# 将二维码图像直接粘贴到背景图上
|
||||
bg_img.paste(qr_img, (0, 0), qr_img)
|
||||
|
||||
return bg_img
|
||||
|
||||
|
||||
# 将二维码图像中的白色背景转为透明
|
||||
def make_background_transparent(img):
|
||||
# 获取图片的像素数据
|
||||
img_data = img.getdata()
|
||||
|
||||
# 创建新的像素列表,透明化白色背景
|
||||
new_data = []
|
||||
for item in img_data:
|
||||
# 如果是白色背景(RGB: 255, 255, 255),则设置透明度为 0
|
||||
if item[0] == 255 and item[1] == 255 and item[2] == 255:
|
||||
new_data.append((255, 255, 255, 0)) # 透明
|
||||
else:
|
||||
new_data.append(item) # 保留原始颜色
|
||||
|
||||
# 更新图像数据
|
||||
img.putdata(new_data)
|
||||
return img
|
||||
|
||||
|
||||
# 创建主窗口
|
||||
window = tk.Tk()
|
||||
window.title("二维码生成器")
|
||||
window.geometry("500x400")
|
||||
|
||||
# 创建输入框和标签
|
||||
label = tk.Label(window, text="请输入内容:", font=("Arial", 12))
|
||||
label.pack(pady=10)
|
||||
|
||||
text_input = tk.Text(window, height=6, width=50)
|
||||
text_input.pack(pady=10)
|
||||
|
||||
# 背景图片选择
|
||||
bg_image_path = tk.StringVar() # 用于存储背景图片路径
|
||||
bg_button = tk.Button(window, text="选择背景图片", font=("Arial", 12), command=select_bg_image)
|
||||
bg_button.pack(pady=5)
|
||||
|
||||
bg_label = tk.Label(window, text="未选择背景图片", font=("Arial", 10))
|
||||
bg_label.pack(pady=5)
|
||||
|
||||
# 创建生成按钮
|
||||
generate_button = tk.Button(window, text="生成二维码", font=("Arial", 12), command=generate_qr)
|
||||
generate_button.pack(pady=10)
|
||||
|
||||
# 启动主循环
|
||||
window.mainloop()
|
|
@ -0,0 +1,64 @@
|
|||
#语法错误SyntaxError:
|
||||
#2_a=2
|
||||
|
||||
#SyntaxError: invalid decimal literal
|
||||
|
||||
|
||||
#list=[2,3,4,5,6,7,8]
|
||||
#for i in list:
|
||||
#list.append(12)
|
||||
|
||||
#SyntaxError: invalid character ':' (U+FF1A)
|
||||
|
||||
|
||||
#for i in range
|
||||
#a=1
|
||||
|
||||
#SyntaxError: expected ':'
|
||||
|
||||
|
||||
|
||||
#类型错误TypeError:
|
||||
#a=1
|
||||
#b='1'
|
||||
#print(a+b)
|
||||
|
||||
#TypeError: unsupported operand type(s) for +: 'int' and 'str'
|
||||
|
||||
|
||||
|
||||
#名称错误NameError:
|
||||
#r
|
||||
|
||||
#NameError: name 'r' is not defined
|
||||
|
||||
|
||||
|
||||
#分数为零ZeroDivisionError:
|
||||
#n=1
|
||||
#print(n/0)
|
||||
|
||||
#ZeroDivisionError: division by zero
|
||||
|
||||
|
||||
|
||||
#值异常ValueError:
|
||||
#a=int("1.4")
|
||||
|
||||
#ValueError: invalid literal for int() with base 10: '1.4'
|
||||
|
||||
|
||||
|
||||
#属性异常AttributeError:
|
||||
#import math
|
||||
#math.goto
|
||||
|
||||
#AttributeError: module 'math' has no attribute 'goto'
|
||||
|
||||
|
||||
|
||||
#下标越界异常IndexError:
|
||||
#list=[1,2,3,4,5,6]
|
||||
#list[6]
|
||||
|
||||
#IndexError: list index out of range
|
|
@ -0,0 +1,5 @@
|
|||
# 点击运行【安装第三方库.py】,即可安装本课用到的第三方库
|
||||
# 使用清华镜像源安装amzqr
|
||||
import pip
|
||||
pip.main(['install', 'qrcode', '--index-url', 'https://pypi.tuna.tsinghua.edu.cn/simple'])
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
print('''
|
||||
********
|
||||
************
|
||||
####....#.
|
||||
#..###.....##....
|
||||
###.......###### ### ###
|
||||
........... #...# #...#
|
||||
##*####### #.#.# #.#.#
|
||||
####*******###### #.#.# #.#.#
|
||||
...#***.****.*###.... #...# #...#
|
||||
....**********##..... ### ###
|
||||
....**** *****....
|
||||
#### ####
|
||||
###### ######
|
||||
##############################################################
|
||||
#...#......#.##...#......#.##...#......#.##------------------#
|
||||
###########################################------------------#
|
||||
#..#....#....##..#....#....##..#....#....#####################
|
||||
########################################## #----------#
|
||||
#.....#......##.....#......##.....#......# #----------#
|
||||
########################################## #----------#
|
||||
#.#..#....#..##.#..#....#..##.#..#....#..# #----------#
|
||||
########################################## ############
|
||||
''')
|
Loading…
Reference in New Issue