Python Commands
Python Commands
File Management
15. open() - Opens a file in a specified mode.
Syntax: file = open("filename.txt", "r")
22. from ... import ... - Imports specific items from a module.
Syntax: from math import sqrt
Exception Handling
24. try / except / finally - Catches exceptions.
Syntax:
try:
x = 10 / 0
except ZeroDivisionError:
print("Cannot divide by zero.")
finally:
print("End of code.")
Miscellaneous Commands
27. help() - Shows help for a function or module.
Syntax: help(len)