|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
from easygui import *
from urllib import *
catsize=multenterbox('please input the size of cat','download a cute cat',['width','height'],[400,600])
while 1:
try:
width=int(catsize[0].strip())
height=int(catsize[1].strip())
except:
catsize=multenterbox('the size should be int ','download a cute cat',['width','height'],catsize)
if isinstance(catsize[0],int) and isinstance(catsize[1],int):
break
response=request.urlopen("http://placekitten.com/g/%d/%d" % (catsize[0],catsize[1])
add=fileopenbox('please choice a place to save cute cat','return is a way')
fileformat='%s/cat_%d_%d.jpg'%(add,catsize[0],catsize[1])
with open(fileformat,'wb') as f:
f.write(response.read())
报错:
File "<ipython-input-3-856134672d1f>", line 13
add=fileopenbox('please choice a place to save cute cat','return is a way')
^
SyntaxError: invalid syntax
请高手指点
response=request.urlopen("http://placekitten.com/g/%d/%d" % (catsize[0],catsize[1])最后少一个右括号
|
|