第十一天作业
# 第一题
import time
import random
def foo():
print('开始执行。。。')
time.sleep(random.uniform(1,3))
print('执行完毕')
return '都结束了'
print(foo())
# 第二题
import time
import random
def foo():
print('开始执行。。。')
time.sleep(random.uniform(1,3))
print('执行完毕')
return '都结束了'
def coo(funs):
def coo1():
k_time = time.time()
l1 = funs()
j_time = time.time()
print(f'时间:{j_time - k_time}')
return l1
return coo1
foo = coo(foo)
foo()
# 第三题
import time
import random
def foo():
print('开始执行。。。')
time.sleep(random.uniform(1,3))
print('执行完毕')
return '都结束了'
name = 'jinyi'
def coo(funs):
def coo1():
l1 = input(f'你的用户名:').strip()
if name == l1:
res = funs()import requests
# 第五题
import requests
# def sp_fu(url):
# response = requests.get(url)
# if response.status_code == 200:
# print(len(response.text))
# print(response.text)
# url = 'https://www.cnblogs.com/xiaoyuanqujing/'
# sp_fu(url)