Skip to Main Content
Python for Secret Agents
book

Python for Secret Agents

by Steven F. Lott
August 2014
Beginner to intermediate content levelBeginner to intermediate
216 pages
5h 13m
English
Packt Publishing
Content preview from Python for Secret Agents

Handling text and strings

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python for Secret Agents - Volume II - Second Edition

Python for Secret Agents - Volume II - Second Edition

Steven F. Lott

Publisher Resources

ISBN: 9781783980420Supplemental Content