1/14
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
breakpoints
set on a specific line of code and forces the debugger to pause whenever the program execution reaches that line
write an assert statement that triggers an AssertionError if the variable spam is an integer less than 10
assert spam >= 10, ‘the spam variable is less than 10.’
write an assert statement that triggers an AssertionError if the variables eggs and bacon contain strings that are the same as each other, even if their cases are different(that is, ‘hello’ and ‘hello’ are considered the same, and ‘ goodbye’ an ‘GOODbye’ are also considered the same)
assert eggs.lower() != bacon.lower() ‘The eggs and bacon variables are the same!’ or assert eggs.upper() != bacon.upper(), ‘The eggs and bacon variables are the same!’
write an assert statement that always triggers an AssertionError
assert False, ‘This assertion always triggers.’
what are the two lines that you program must have in order to be able to call logging.debug()?
import logging
logging.basicConfig(level=logging.DEBUG, format =’ %(asctime)s - %(levelname)s - %(message)s’)
what are the five logging levels?
DEBUG, INFO, WARNING, ERROR, and CRITICAL
what line of code can you add to disable all logging messages in your program?
logging.disable(logging.CRITICAL)
why is using logging messages better than using print() to display the same message?
-you can disable logging messages w/o removing the logging function calls
-you can selectively disable lower-level logging messages
-you can create logging messages
-logging messages provides a timestamp
what is a breakpoint
setting on a line of code that causes the debugger to pause when the program execution reaches the line
web scraping
using a program to download and process content from the web
webbrowser logging module
comes w/ python and opens a browser to a specific page
requests logging module
downloads files and web pages from the internet
bs4 logging module
parses HTML, the format that web pages are written in
selenium logging module
launches and control a web browser
webbrowser.open() functoin
launch a new browser to a specified URL