随笔分类 -  Python

摘要:weather forecast names package and module names :short,all lowercase names class names :CapWords function names : lowercase,with words separated by u... 阅读全文
posted @ 2015-12-09 15:44 iamaprin 阅读(347) 评论(0) 推荐(0)
摘要:ascii(object) 同repr(),返回一个可打印的对象,但是字符串中非ascii字符用repr()以\x、\u、\U返回。类似于Python2中的repr()函数。 print(ascii('王')) '\u738b' bin(x) 转换一个integer对象为二进制字符串。如果x不是integer对象,则需要定义返回interger对象的_index_()方法。 print(bin(... 阅读全文
posted @ 2015-05-08 21:20 iamaprin 阅读(110) 评论(0) 推荐(0)
摘要:abs(x) 返回x的绝对值,x可以是integer/float型数。如果x是一个复数,则返回其模值。 x=-5 print(abs(x)) 5 x=3+4j print(abs(x)) 5 all(iterable) 如果iterable里面的元素都是true(或者为空),返回true.(iterable可以迭代的容器,数组、列表等) iterable=[1,2,3,4,5,6] prin... 阅读全文
posted @ 2015-05-07 22:20 iamaprin 阅读(162) 评论(0) 推荐(0)