August 2019
Beginner
482 pages
12h 56m
English
Now that the package structure is in place, we can start adding the actual code. For starters, we copy and paste the code from Chapter 7, Scraping Data from the Web with Beautiful Soup 4, for the wiki.py package. As we want to have code for both collecting and cleaning in the same package, it sounds smart to create two sub-folders—collect and parse. The code from Chapter 7, Scraping Data from the Web with Beautiful Soup 4, will go to the latter one. For now, we will create two files—battles.py and fronts.py—in the parse folder. In Python, upon import, they will be mapped to a path such as wikiwwii.parse.battles, enabling access to all the functions and variables in them.
Next, we add the code for cleaning in a similar fashion. ...