Python built-in functions

Source: Internet
Author: User

help()   //获取帮助信息dir()    //查看对像内所有属于及方法type(参数)  //查看参数的类型import//导入模块(当为第一次导入的时候,其实会去执行一遍被调用的文件中的内容。再次调用时,就不会执行被调用文件中的内容)reload(方法名)  //import是第二次导入的时候不会执行被调用文件的内容,但是如果第二次导入时候用reload的话,那么就会再次执行被调用文件的内容。id(参数)   //获取idabs(参数)  //取绝对值bool(参数)  //将一个值转为booldivmod94)  //结果为元组(21) 商21 max(列表)  //取最大值参数为列表min(列表)  //取最小值参数为列表sum(列表)  //求和参数为列表pow210)  //指数,表示210次方len(参数)  //获取长度,如果是汉字的话,获取的是字节的长度all(可迭代的参数)   //当可迭代的值所有为真的时候返回真,否则返回假。(可迭代的参数是指可以循环的,例如:list...)any(可迭代的参数)  //当一个为真时,返回就是真chr(数字)  //将数字转换为对应的Ascall码 ord(参数)  //将参数转换为数字,和chr相反hex(数字)  //将之转换为16进制bin(数字)  //将之转换为2进制oct(数字)  //将之转换为8进制enumerate(列表,起始值) //将列表加上序号,可设置序号的起始值字符串.format‘占位符的值‘)  map(函数,列表) //遍历序列中的每个数,传入到函数中执行 filter(函数,列表) //函数返回true和false,返回true的就是filter的结果。 reduce(函数,列表) //函数执行结果的和(注意,reduce必须接收两个参数)zip(多个列表) //将传入的列表的列,组成一个新的列表。(如果有一列元素不足,那么将不会显示)eval(字符串表达式) //传入一个字符串表达式,输出计算的结果

Note: Python's comment is #, use//Is my habit

Original Address HTTP://REXYAN.CN/ARTICLE/21

Python built-in functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.