Outline for February 8, 2012
Reading:
§8, 11
String module
import string
String methods:
s.capitalize()
,
s.replace(old, new)
,
s.find(sub)
,
s.rfind(sub)
,
s.upper()
,
s.lower()
Example [
str_array.py
]
Lists
Sequence of values (ints, floats, strings, other lists, etc.)
Denoted by square brackets
[ ]
with values separated by commas
Lists are mutable
How to create a list
Type conversion
str(val)
attempts to convert
val
to a string
list(sequence)
attempts to convert
sequence
to a list
A PDF version is available here.
ECS 10, Basic Concepts of Computing
Winter Quarter 2012