Reminders
#TODO
How to print an exception in Python? - Stack Overflow
Install
Links to Solutions
Is key in dictionary
# Dictionary Initialisation
My_Dict = {'Joy':78, 'John':96, 'Kyler':65, 'Sona':85}
My_key = input("Enter the key to be searched: ")
if My_key in My_Dict:
print("Found!")
else:
print("Not Found!")
https://www.journaldev.com/40231/check-if-a-key-exists-in-python-dictionary
Optional Arguments
Setting optional arguments
https://codereview.stackexchange.com/questions/148153/optional-arguments-in-a-function
How to sort a column in a multi dimentional list
https://stackoverflow.com/questions/20183069/how-to-sort-multidimensional-array-by-column
Try and Except
try:
some_method()
except Exception as e:
s = str(e)
Get the Exception Value
Regex a list
subprocess
``` python import subprocess
vp
JSON output
command = ["keybase", "chat", "api", "-m", dentropydaemon_channels_json] response = subprocess.check_output(command) return json.loads(response.decode('utf-8'))
Search Code Snippets | python capture output of os.system
URL from string
from urlextract import URLExtract
extractor = URLExtract()
urls = extractor.find_urls("Github https://github.com is fucking evil")
print(urls)
TODO
https://www.digitalocean.com/community/tutorials/how-to-import-modules-in-python-3
https://stackoverflow.com/questions/20001229/how-to-get-posted-json-in-flask
https://stackoverflow.com/questions/34439/finding-what-methods-a-python-object-has
https://stackoverflow.com/questions/9535954/printing-lists-as-tabular-data
python - How can I safely create a nested directory? - Stack Overflow
- Strings
- What does %s mean in a python format string? - Stack Overflow
- [) for great good!%20for%20great%20good!)%20for%20great%20good!)%20for%20great%20good!)%20for%20great%20good!)%20for%20great%20good!)
- What does %s mean in a python format string? - Stack Overflow
How to import from other folder
Relative Imports in Python - Without Tearing Your Hair Out | Aiming to Misbehave