1、一组数,挑出第二大的数字
import re
import requests
def t1(l_, x):
n = set(l_)
r = sorted(n, reverse=True)
return r[x]
print(t1([1, 4, 7, 902, 902], 1), )
2、数据量很多采用什么方法?
采用什么数据结构
3、下载一组图片
输入一个元素为字符串的列表
def get_url(u, m="POST"):
for u_ in u:
r = requests.request(m, u_)
html = r.content
print(html)
with open(‘%s.png‘ % u_.split("/")[-1].split(".")[0], ‘wb‘) as f:
f.write(html)
return
u1="https://up.ruyile.com/jy_img/cj/14/169/33520l91.jpg"
# u2="https://img.tupianzj.com/uploads/allimg/202007/9999/5f552d9fd7.jpg"
tu = [u1]
print(get_url(tu))
下载的图片有问题
image not loaded try to open it externally to fix format problem
4、采用什么方法测试
5、代码有哪些优化空间
1 保护
2 中断怎么办
3 特别大的连接怎么办
4 数量巨大怎么办
原文:https://www.cnblogs.com/lx63blog/p/13378890.html