python内建函数是什么

434次阅读
没有评论

python内建函数是什么

python内建函数是什么

python内建函数是启动python解释器后,默认加载的函数称为内建函数。由cpython执行的c语言编写的函数,在加载速度上优于开发者自定义的函数。

python查看内建函数方法

方式一:

dir(__builtins__)

方式二:

import builtins
dir(builtins)

执行 help(thing) 可查看函数的使用方法及其解释信息,‘thing’是以上任意函数名

>>>help(sum)
>Help on built-in function sum in module builtins:
 
sum(iterable, start=0, /)
    Return the sum of a 'start' value (default: 0) plus an iterable of numbers
    
    When the iterable is empty, return the start value.
    This function is intended specifically for use with numeric values and may
    reject non-numeric types.

使用help可以很详细的了解到这些函数使用的参数、返回值、返回类型及其构造原理。

python内建函数分类

数学运算(7个)

类型转换(24个)

序列操作(8个)

对象操作(7个)

反射操作(8个)

变量操作(2个)

交互操作(2个)

文件操作(1个)

编译执行(4个)

装饰器(3个)

以上就是python内建函数的基本介绍,大家在掌握这方面的知识点后,可以就其中的一些内建函数进行练习。

(推荐操作系统:windows7系统、Python 3.9.1,DELL G3电脑。)

神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试

相关文章:

版权声明:wuyou2021-04-30发表,共计757字。
新手QQ群:570568346,欢迎进群讨论 Python51学习