PY-04-P1 File System and Error Handling Flashcards
___ creates a code block to try to execute code that may create an error
Try
____ handles an error in the try code
Except
runs only if no exception occured
Else
runs whether the code failed or succeeded
Finally
prints a custom error message
Raise
inserts an error message in a variable
Exception as a error
What is a file categorized as in Python
text or binary
enables access to a file for the python interpreter
Open( )
must be added after open to be able to read the file and/or save changes made
close()
writes content to an open file
write()
allows reading the file according to the permission
read()
is used to read a file line by line
readline( )
can also be used to read the number of bytes from the line
readline ( )
this function saves and closes a file
close
The f____ function is used to save a file and continute editing it
flush ( )