練習題2

一,轉字節的兩種方式 s=‘老男孩’ print(type(s)) a=bytes(s,‘utf8’) s.encode(‘utf8’) 二,reduce+lambda實現7! from functools import reduce print(reduce(lambda x,y:x*y,[x for x in range(1,8)])) 使用函數的方式實現7! 三,利用with實現同時打開兩個
相關文章
相關標籤/搜索