09 2015 档案
摘要:字符串格式化符号格式化字符 转换方式%c 转换成字符(ASCII码值,或者长度为一的字符串)%r 优先用repr()函数进行字符串转换%s 优先用str()函数进行字符串转换%d/%i 转成有符号十进制数%u 转成无符号十进制数%o 转成无符号八进制数%x/%X (Unsigned)转成无符号十六进...
阅读全文
摘要:5-8Geometryimport mathdef sqcube(): s = float(raw_input('enter length of one side: ')) print 'the area is:', s ** 2., '(units squared)' print 'the ...
阅读全文
摘要:1.简介默认,浮点数学缺乏精确性decimal模块提供了一个Decimal数据类型用于浮点数计算。相比内置的二进制浮点数实现float这个类型有助于金融应用和其它需要精确十进制表达的场合,控制精度,控制舍入以适应法律或者规定要求,确保十进制数位精度,或者用户希望计算结果与手算相符的场合。Decima...
阅读全文
摘要:random1.简介random是用于生成随机数,我们可以利用它随机生成数字或者选择字符串>>>importrandom>>>dir(random)['BPF','LOG4','NV_MAGICCONST','RECIP_BPF','Random','SG_MAGICCONST','SystemRa...
阅读全文
摘要:1.math简介>>>importmath>>>dir(math)#这句可查看所有函数名列表['__doc__','__name__','__package__','acos','acosh','asin','asinh','atan','atan2','atanh','ceil','copysig...
阅读全文
摘要:4-1Python objects All Python objects have three attributes:type,ID,and value. All are readonly with a possible expection of the value(which can be c...
阅读全文
摘要:3-4Statements Ues ;3-5Statements Use\(unless part of a comma-separated sequence in which case \ is optional)
阅读全文
摘要:2-5 Loops and Numbers a) i = 0 while i 0: print 'positive' else: print 'zero'2-7 Loops and strings s = raw_input('enter a string:') for ...
阅读全文
摘要:1.1文件对象文件只是连续的字节序列。数据的传输经常会用到字节流,无论字节流是由单个字节还是大块数据组成.1.2文件内建函数open()和file() 内建函数open()的基本语法是: file_object=open(file_name,access_mode='r',buffering=-1)...
阅读全文
摘要:1、进入win102、下载EasyBCD,360软件管家里面有,version=2.23、启动软件,工具箱里面选择“BCD部署”→MBR配置选项中选“在MBR中安装Windows Vista/7的bootloader”→点击编写MBR4、右键“此电脑”→管理→管理磁盘→删除ubuntu所在分区→新建...
阅读全文
摘要:for index,value in enumerate(list):print index,value等于for i in range(0,len(list)): print i,list[i]
阅读全文
摘要:>>> a='bbc'>>> a'bbc'>>> print abbcstr()一般是将数值转成字符串;repr()是将一个对象转成字符串显示,注意只是显示用,有些对象转成字符串没有直接的意思。print 语句调用 str()函数显示对象,而交互式解释器则调用 repr()函数来显示对象。
阅读全文

浙公网安备 33010602011771号