list1=[12,34,4,5,343,54]#定义一个数组
list1.sort(reverse=False) #返回列表排序
print(list1)
import random 导入random模块
lst=[1,44,"hhh"]
print(random.choice(lst)) #从列表返回一个随机值
print(random.randint(1,2)) #返回一个范围的整数随机值
with open(r'test.txt',mode='w',encoding='utf_8') as f: #r是转义 mode:w(写入)默认a(读)
f.write("测试文本")
with open(r'test.txt',encoding='utf_8') as f:
print(f.read()) #打印f文件的读
try:
a=int(input("请输入一个数值"))
print(a)
except ValueError:
print("无输入")