Section 6.21. Summary of Sequences


6.21. Summary of Sequences

Sequence types provide various mechanisms for ordered storage of data. Strings are a general medium for carrying data, whether it be displayed to a user, stored on a disk, transmitted across the network, or be a singular container for multiple sources of information. Lists and tuples provide container storage that allows for simple manipulation and access of multiple objects, whether they be Python data types or user-defined objects. Individual or groups of elements may be accessed as slices via sequentially ordered index offsets. Together, these data types provide flexible and easy-to-use storage tools in your Python development environment. We conclude this chapter with a summary of operators, built-in functions and methods for sequence types given in Table 6.13.

Table 6.13. Sequence Type Operators, Built-in Functions and Methods

Operator, Built-in Function or Method

String

List

Tuple

[] (list creation)

 

 

()

  

""

  

append()

 

 

capitalize()

  

center()

  

chr()

 

cmp()

count()

 

decode()

  

encode()

  

endswith()

  

expandtabs()

  

extend()

 

 

find()

  

hex()

  

index()

 

insert()

 

 

isdecimal()

  

isdigit()

  

islower()

  

isnumeric()

  

isspace()

  

istitle()

  

isupper()

  

join()

  

len()

list()

ljust()

  

lower()

  

lstrip()

  

max()

min()

oct()

  

ord()

  

pop()

 

 

raw_input()

  

remove()

 

 

replace()

  

repr()

reverse()

 

 

rfind()

  

rindex()

  

rjust()

  

rstrip()

  

sort()

 

 

split()

  

splitlines()

  

startswith()

  

str()

strip()

  

swapcase()

  

split()

  

title()

  

tuple()

type()

upper()

  

zfill()

  

.(attributes)

 

[] (slice)

[:]

*

%

  

+

in

not in




Core Python Programming
Core Python Programming (2nd Edition)
ISBN: 0132269937
EAN: 2147483647
Year: 2004
Pages: 334
Authors: Wesley J Chun

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net