|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import pickle
def get_info():
list=pickle.load(list, open('data.pkl', 'rb'))
return list
try:
list=get_info()
except :
price=0,obj="",saved=0,a1=[],a2=[],a3=[] ,
month1=0 , month2=0 , month3 = 1 , day1 = 0 , day2 = 0 , day3 = 0
list=[obj,price,saved,a1[month1,day1],a2[month2,day2],a3[month3,day3]]
obj=input("请输入当前目标购买的物品:\n")
price=int(input("物品金额是:\n"))
except后面的price,obj,month1等变量赋值报错:can't assign to literal
给多个变量赋值不是这样的,应该:
import pickle
def get_info():
list=pickle.load(list, open('data.pkl', 'rb'))
return list
try:
list=get_info()
except :
price, obj, saved, a1, a2, a3 = 0, "", 0, [], [], []
month1, month2, month3, day1, day2, day3 = 0, 0, 1, 0, 0, 0
list=[obj,price,saved,a1[month1,day1],a2[month2,day2],a3[month3,day3]]
obj=input("请输入当前目标购买的物品:\n")
price=int(input("物品金额是:\n"))
|
|