python中的一段程序不懂
本帖最后由 cql123 于 2018-5-27 10:04 编辑import easygui as g
msg="Enter your personal information"
title="Credit Card Application"
fieldNames=["Name","Street Address","City","State","ZipCode"]
fieldValues=[]
fieldValues=g.multenterbox(msg,title, fieldNames)
while 1:
if fieldValues == None: break #如果filedValues为空的话,就跳出循环了吗?,我运行代码,如果不输入任何东西的话,程序也没有跳出循环,这是为什么?,这句代码有什么用?
errmsg= ""
for i in range(len(fieldNames)):
if fieldValues.strip() == "":
errmsg+= ('"%s" is a required field.\n\n' % fieldNames)
if errmsg == "":
break # no problems found
fieldValues =g.multenterbox(errmsg, title, fieldNames, fieldValues) 点 取消 返回 None
请查看multenterbox的返回值情况 把none改为[]{:10_279:}
页:
[1]