M03 - Read Files Flashcards
1
Q
IndentationError
A
Cause: did not indent code after a colon
Solution: indent code after colon that should run as the block
2
Q
SyntaxError
A
Possible Cause: no colon at the end of statement where one should be
Solution: find and add colon
3
Q
reader( ) function syntax
A
file_reader_variable = csv.reader(file_variable/alias given using with or open( ))
4
Q
next( ) syntax to print header row
A
# Read file w/ reader function file_reader = csv.reader(file_alias)
#Print header row headers = next(file_reader) # Prints the first row print(headers)
5
Q
next( ) what it does
A
Skips first row and returns next item in list