文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Sequence Overview

Sequence Overview

时间:2011-01-18  来源:吴X

 

Sequence Overview

 

Python has six built-in types of sequences. This chapter concentrates on two of the most common ones: lists and tuples.

The other built-in sequence types are strings (which I revisit in the next chapter ), Unicode strings, buffer objects, and xrange objects.

 

 

Common Sequence Operations

indexing,slicing,adding,multiplying, and checking for membership.

 

List Comprehension

List Comprehension is  a way of making lists from other lists( similar to set comprehension, if you know that term form mathematics). It works in a way similar to for loops and is actually quite simple:

>>> [x*x for x in range(10)]

 

 

eval and exec

eval ( raw_input("enter an arithmetic expression:"))

input:  6 + 18 *2

42

exec('print "helloworld"')

 

相关阅读 更多 +
排行榜 更多 +
航母指挥官2免安装绿色中文版

航母指挥官2免安装绿色中文版

角色扮演 下载
《空洞骑士:丝之歌》大黄蜂的深灰斗篷MOD

《空洞骑士:丝之歌》大黄蜂的深灰斗篷MOD

行业软件 下载
《上古卷轴5:天际重制版》冒险家混搭黑色重新着色MOD

《上古卷轴5:天际重制版》冒险家混搭黑色重新着色MOD

行业软件 下载