zoukankan      html  css  js  c++  java
  • Sequence Overview

    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"')

  • 相关阅读:
    10-12
    8-10
    5.2-5.3
    四则运算 测试与封装
    第5-7章
    汉堡包
    1-5章
    实验二
    实验一
    Controller方法是如何与请求匹配上的及参数如何填充的
  • 原文地址:https://www.cnblogs.com/wucg/p/1938549.html
Copyright © 2011-2022 走看看