from urllib import request
import time
message = '''Welcome WebRequest:
请输入网址,会自动开始采集网页代码
采集完成会在目录下自动生成一个text文件
'''
message1 = '''正在读取...'''
message2 = '''读取完成!'''
print(message)
web = str(input('请输入要读取的网址:'))
print(message1)
start = time.time()
response = request.urlopen(web)
with open("RequestWeb.txt", 'w') as f:
f.write(str(response.read()))
print(message2)
stop= time.time()
print(f"本次一共耗费了 {(stop-start):.2f} 秒.") Learning...{:10_261:} import pickle
x, y, z = 1, 2, 3
s = "FishC"
l = ["小甲鱼", 520, 3.14]
d = {"one": 1, "two": 2}
with open("data.pkl", "wb") as f:
pickle.dump(x, f)
pickle.dump(y, f)
pickle.dump(z, f)
pickle.dump(s, f)
pickle.dump(l, f)
pickle.dump(d, f)
with open("data.pkl","wb") as f:
x,y,z,s,l,d = pickle.load(f)
print(x,y,z,s,l,d,sep="\n")
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\1.py", line 17, in <module>
x,y,z,s,l,d = pickle.load(f)
io.UnsupportedOperation: read
求救求救
{:10_266:}{:10_266:}{:10_266:}{:10_266:}
问答题答案:
动动手答案:
打卡 请问二进制文件怎么打开
页:
[1]