上QQ阅读APP看书,第一时间看更新
Extracting data from structured strings
In a lot of automated tasks, we'll need to treat input text that's in a particular format and extract the relevant information. For example, a spreadsheet may define a percentage in text (such as 37.4%) that we want to retrieve in numerical format to apply it later (0.374, as a float).
In this recipe, we'll see how to process sale logs that contain inline information about a product, such as sold, price, profit, and some other information.