August 2014
Beginner to intermediate
216 pages
5h 13m
English
We've glossed over Python's use of string objects. Expressions such as Decimal('247.616') and input(GRD conversion: ) involve string literal values. Python gives us several ways to put strings into our programs; there's a lot of flexibility available.
Here are some examples of strings:
>>> "short" 'short' >>> 'short' 'short' >>> """A multiple line, ... very long string.""" 'A multiple line,\nvery long string.' >>> '''another multiple line ... very long string.''' 'another multiple line\nvery long string.'
We've used single quotes and apostrophes to create short strings. These must be complete within a single line of programming. We used triple quotes and triple apostrophes to create long strings. These strings can stretch ...