Commands
Stable release
Objectives
Understand how static site generators build websites out of plain text files.
Create example Sphinx documentation and learn some Markdown along the way.
Note
sphinx-autobuild content/ _build/
Questions
Do you have any questions?
Solution
import pandas as pd
def get_spreadsheet_columns(file_loc, print_columns=False):
"""Gets and prints the spreadsheet's header columns
Args:
file_loc (str): The file location of the spreadsheet
print_columns (bool, optional) : A flag used to print the columns to the console (default is False)
Returns:
a list of strings used that are the header columns
"""
file_data = pd.read_excel(file_loc)
column_headers = list(file_data.columns.values)
if print_columns:
print("\n".join(column_headers))
return column_headers
Warning
Do not use comments for:
Keeping zombie code
# Do not run this code!:
# if temperature > 0:
# print('It is warm')
In-code-1: Comments
Let’s take a look at two example comments (comments in python start with
#
):Comment A
Comment B
Which of these comments is best? Can you explain why?