Chinaunix首页 | 论坛 | 博客
  • 博客访问: 20977
  • 博文数量: 27
  • 博客积分: 585
  • 博客等级: 中士
  • 技术积分: 270
  • 用 户 组: 普通用户
  • 注册时间: 2012-07-20 17:11
文章分类

全部博文(27)

文章存档

2013年(1)

2012年(26)

我的朋友
最近访客

发布时间:2012-12-27 10:35:52

十一、元组的使用 元组和列表十分类似,只不过元组和字符串一样是不可变的 即你不能修改元组。元组通过圆   括号中用逗号分割的项目定义。元组通常用在使语句或用户定义的函数能够安全地采用一组值   的时候,即被使用的元组的值不会改变   zoo = ('wolf', 'elephant', 'penguin')  #使用圆括号来添加成员的   print 'Number of animals in the zoo is', len(zoo)   new_zoo = ('monkey', 'dolphin', zoo)......【阅读全文】

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

发布时间:2012-12-27 10:21:26

六、向数组中添加内容append   shoplist = ['apple', 'mango', 'carrot', 'banana']   print 'I have', len(shoplist),'items to purchase.'   print 'These items are:', # Notice the comma at end of the line   for item in shoplist:   # 遍历数组使用的是 for item in shoplist   &nb......【阅读全文】

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

发布时间:2012-12-27 09:22:21

一、python中的List:   Example 3.25. key s,  values  和  i tems  函数 >>> params =  {"server":"mpilgrim", "database":"master", "uid":"sa", "pwd":"secret"} >>> params.keys()   (1) ['server', 'uid', 'database', 'pwd']   >>> params.......【阅读全文】

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

发布时间:2012-12-27 09:17:17

单引号和双引号: 在双引号中的字符串与单引号中的字符串的使用完全相同使用三引号('''或"""): 利用三引号,你可以指示一个多行的字符串。你可以在三引号中自由的使用单引号和双引号。 例如: '''This is a multi-line string. This is the first line. This is the second line. "What's your name?," I asked. He said "Bond, James Bond." '''转义符: 'What\'s you name'   (注意要加上\来转义'不然python会不认识')级......【阅读全文】

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

发布时间:2012-09-04 22:03:09

简介 <p style="font-size: 12.800000190734863px; line-height: 1.4; margin: 5p......【阅读全文】

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

登录 注册