摘要:
一、类型转换函数函数 描述 int(x [,base ]) 将x转 换为一个整数 (其中base表示基数)long(x [,base ]) 将 x转换为一个长整数 float(x ) 将 x转换到一个浮点数 complex(real [,imag ]) 创建一个复数 str(x ) 将 对象 x 转换为字符串 repr(x ) 将对象 x 转换为表达式字符串 eval(str ) 用来计算在字符串中的有效Python表达式,并返回一个对象 tuple(s ) 将 序列 s 转换为一个元组 list(s ) 将序列 s 转换为一个列 表 chr(x ) 将一个整数转换为一个字符 unichr(x 阅读全文
posted @ 2012-05-28 17:21
DuSizhong
阅读(4448)
评论(0)
推荐(0)
摘要:
View Code 1 from 模块 import 函数 2 >>> from math import sin 3 >>> sin(1.5) 4 0.9974949866040544 5 6 直接import 7 >>> import cmath 8 >>> cmath.sqrt(-9) 9 3j 10 11 字符串表示,str和repr 12 >>> print 100000L 13 100000 14 >>> print (10000L) 15 10000 16 >>& 阅读全文
posted @ 2012-05-28 17:19
DuSizhong
阅读(223)
评论(0)
推荐(0)

浙公网安备 33010602011771号