Chinaunix首页 | 论坛 | 博客
  • 博客访问: 104438
  • 博文数量: 67
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 577
  • 用 户 组: 普通用户
  • 注册时间: 2014-04-16 09:51
个人简介

啄木鸟专吃虫,故名啄木鸟。

发布时间:2014-08-22 14:03:17

>>> round(1.6)2.0>>> round(1.4)1.0>>> int(1.6)1>>> int(1.4)1>>> floor(1.6)Traceback (most recent call last):  File "<pyshell#5>", line 1, in <module>    floor(1.6)NameError: name 'floor' is not defined>>> import math>>> math.floor(4.7)4.0>>> math.floor(4.2)4.0.........【阅读全文】

阅读(309) | 评论(0) | 转发(0)

发布时间:2014-08-22 11:23:03

处于python学习的菜鸟阶段的初级阶段,对于这个sort和sorted真是没搞明白。今天好好来理一理.....首先,sort是list的成员函数,sorted是python的内建函数基础用法:>>> st'feaqsa'>>> sorted(st) #   返回序列排序后的列表,st并未变化['a', 'a', 'e', 'f', 'q', 's']>>> st'feaqsa'>>> st.sort() &nbs.........【阅读全文】

阅读(1655) | 评论(0) | 转发(0)

发布时间:2014-08-21 18:58:23

对List进行排序,Python提供了两个方法方法1.用List的内建函数list.sort进行排序list.sort(func=None, key=None, reverse=False) Python实例:>>> list = [2,5,8,9,3]  >>> list  [2,5,8,9,3]  >>> list.sort()  >>> list.........【阅读全文】

阅读(360) | 评论(0) | 转发(0)

发布时间:2014-08-21 15:54:22

python中的random模块主要用于产生随机数或有序的数,今天学习其主要的几个函数:一.random() 返回一个浮点数   0> random.random()0.4813484817664019>>> random.random()0.5875121706976905二.choice() 随机返回序列中的一个元素,函数模型为:random.choice(seq)>>> s = ['1',2,'s','g',5,8].........【阅读全文】

阅读(2688) | 评论(0) | 转发(0)

发布时间:2014-06-09 11:40:04

os.linesep字符串给出当前平台使用的行终止符。例如,Windows使用'\r\n',Linux使用'\n'而Mac使用'\r'。......【阅读全文】

阅读(347) | 评论(0) | 转发(0)
给主人留下些什么吧!~~
留言热议
请登录后留言。

登录 注册