Skip to content

Instantly share code, notes, and snippets.

View akash-coded's full-sized avatar
🎯
Focusing

Akash Das akash-coded

🎯
Focusing
View GitHub Profile
@akash-coded
akash-coded / check-function-arguments.py
Created March 12, 2020 14:07
Sometimes, it is required to know the arguments that a function expects, their ordering, the default values and all the other goodies. This is especially useful when we don't have access to the source code where the function has been defined. Thankfu
from googlesearch import search
import inspect
print(str(inspect.signature(search)))
@akash-coded
akash-coded / try-except-finally.py
Created March 12, 2020 14:14
Try with resources, except when you can't and finally, make things work.
try:
with open('hshhj.txt', mode = 'r'):
print("File opened")
except FileNotFoundError as e:
print("Error opening file")
print(e)
finally:
print("Some operation independent of file contents")