亚洲一区精品自拍_2021年国内精品久久_男同十八禁gv在线观看_免费观看a级性爱黄片

Article / 文章中心

Python編程:partial偏函數(shù)

發(fā)布時(shí)間:2021-11-23 點(diǎn)擊數(shù):776
# -*- coding: utf-8 -*-  # @File    : partial偏函數(shù).py # @Date    : 2018-05-30 # @Author  : Peng Shiyu  from functools import partial  # 默認(rèn)按十進(jìn)制轉(zhuǎn)換 r1 = int("12") print(r1, type(r1)) # 12 <class 'int'>  # 按二進(jìn)制轉(zhuǎn)換 r2 = int("0101", base=2) print(r2, type(r2)) # 5 <class 'int'>  # 使用偏函數(shù), 改造原有的int函數(shù) int2 = partial(int, base=2) r3 = int2("0101") print(r3, type(r3)) # 5 <class 'int'>