Chinaunix首页 | 论坛 | 博客
  • 博客访问: 305403
  • 博文数量: 214
  • 博客积分: 4258
  • 博客等级: 上校
  • 技术积分: 2021
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-02 09:16
个人简介

http://blog.csdn.net/ly21st http://ly21st.blog.chinaunix.net

文章分类

全部博文(214)

文章存档

2018年(16)

2015年(1)

2014年(2)

2012年(22)

2011年(173)

发布时间:2011-09-30 15:22:10

6.1 创建函数 注意:函数callable在Python3.0中不再可用,需要使用表达式hasattr(func,__call__)代替++++++++++++++++++++++++++++++++++6.2 记录函数 1 文档字符串  6.3 收集参数 >>> def print_params(*params):     .........【阅读全文】

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

发布时间:2011-09-29 22:53:52

5.1 使用逗号输出 >>> print 'hello' ,'liyuan'hello liyuan5.2 一些迭代工具 1 并行迭代>>> names=['anne','beth','george','damon']>>> ages=[12,45,32,102]>>> for i in range(len(names)):       print names[i], 'is'.........【阅读全文】

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

发布时间:2011-09-29 17:10:31

4.1 创建和使用字典 >>> phonebook={'Alice':'2341','Beth':'9102','Cecil':'3258'}>>> phonebook{'Beth': '9102', 'Alice': '2341', 'Cecil': '3258'}注意:字典中的键是唯一的(其他类型的映射也是如此),但值并不唯一。 dict函数:通过其他映射(比如其他字典).........【阅读全文】

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

发布时间:2011-09-29 14:19:37

3.1 格式化字符串 >>> format="hello,%s.%s enough for ya?">>> values=('world','hot')>>> print format % valueshello,world.hot enough for ya?  >>> format='hello %.4f'>>> from math import pi>>> print format % pihello 3.1416.........【阅读全文】

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

发布时间:2011-09-29 09:28:16

第一章基础知识 1.4 数字和表达式 >>>1/2在3.0版本以前,输出结果为0如果希望Pythoh只执行普通的除法,可以在程序前加上以下语句,或者直接在解释器里面执行它:>>>from __future__  import  division还有一个方法,通过在命令行(如linux系统)运行Python,可以使用命令开关.........【阅读全文】

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

登录 注册