Outline for November 7, 2012
Reading: § 12
Assignment Due: Friday, November 9, 2012 at 5:00 PM
- String module import string
- String constants: string.ascii_letters, string.digits, string.punctuation, string.whitespace
- Looping over strings: for i in str
- Format strings — see “Printing” handout
- Format escapes: %d, %e, %f, %s
- Format fields: %3d, %06d, %-6d, %6.2f
- Formatted strings: "$%f" % (1.39) prints $1.39
- Example [str_array.py]
A PDF version is available here.
|
ECS 10, Basic Concepts of Computing
Fall Quarter 2012
|