8. Strings#
Strings are not like integers, floats, or booleans. A string is a sequence, which means it contains multiple values in a particular order.
In this chapter, we’ll learn how to access the individual values that comprise a string and utilize functions that process strings.
We’ll also utilize regular expressions, a powerful tool for identifying patterns in a string and performing operations such as search and replace.
re.search(pattern, text)
| alternative patter(s)
^
$
re.sub(pattern, text, line)
As an exercise, you’ll have a chance to apply these tools to perform text analysis, which should be inspirational in learning more about text-mining and eventually lead to language models.