Introduction to Material Properties

Introduce the reader to aluminum material properties, web scraping, and saving data to an Excel file.

We'll cover the following

Material properties

You used Requests earlier to scrape a website and do something with the results. That website functioned more like an API because you knew exactly what format the website would return. Having the data nicely formatted does not always happen. Sometimes, you have to find and format, clean, or otherwise manipulate the data ourselves. When you scrape a real website, you will need to be able to parse through HyperText Markup Language (HTML) to get the information that you want. On any webpage that you visit, HTML and its sister Cascading Style Sheets (CSS) are hard at work to display the design of the particular webpage. The Engineering Toolbox website [1] contains technical data, material properties, chemical properties, economic information, drawing tools, and so much more for all types of engineers. You will make a Python program to grab information related to the material properties of different aluminium alloys from the Engineering Toolbox website. The program will put this information into an Excel spreadsheet so you can reference it later. BeautifulSoup4 is the preferred library for HTML parsing. The documentation for BeautifulSoup [2] is very good. Openpyxl is the preferred cross-platform library for manipulating Excel spreadsheets; Openpyxl’s documentation can be found under footnote [3].

The program will need to go to the material properties page [4], convert the table into a nested list so the information is easily parse-able, and iterate through the info to put each value into a cell in an Excel spreadsheet.


About HTML

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy