# Using 'with' block
with open(log, "r") as f:
print(f.read())
# Without 'with' statement, you've to write like below
f = open(log, "r")
print(f.read())
f.close()
# Return all variable, classes, objects (collectively under 'names') available
>>> dir()
## Output
['__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__']
>>> from datetime import datetime
>>> dir()
## Output
['__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'datetime']
>>> import example1
>>> dir()
## Output
['__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'datetime', 'example1']
# Return attributes of an object
# dir(name)
>>> dir(example1)
## Output (partial)
['__author__', '__author_email__', '__builtins__', '__cached__', '__copyright__', 'doubler']
>>> print(example1.__author__)
## Output
Hank Preston
# Build-in help system. Display docs and info for object
# help(name)
>>> help(example1.doubler)
## Output
doubler(number)
Given a number, double it and return the value
>>> mynum = example1.doubler(32)
>>> print(mynum)
## Output
64