下面程序的输出结果是
d = lambda p:p*2
t = lambda p:p*3
x = 2
x = d(x)
x = t(x)
x = d(x)
print(x)
24
以下函数需要在其中引用一个全局变量k, 请填写语句
def fun():
__________
k = k+1
def fun():
global k
k = k + 1
用Python实现99乘法表(用两种不同的方法实现)
for i in range(1, 10):
for j in range(1, i+1):
print('{}x{}={} '.format(j, i, i*j), end='')
print()
i = 1
while i <= 9:
a = 1
while a <= i:
print("%d*%d=%2d" % (i,a,i*a),end=" ")
a+=1
print()
i+=1
一个大小为100G的文件etl_log.txt, 要读取文件中的内容, 写出具体过程代码?
with open('etl_log.txt','r',encoding='utf-8')as a:
for i in a:
info = a.readlines()
print(info)
fp = open("文件名","模式","编码集") #迭代器