Dates and Times For using dates and times you need to import the datetime module. There are two types of date and time objects: naive and aware. The objects that are timezone aware are the most used. Examples Extract date >>>...
String Pattern Matching For using String Pattern Matching you need to import the re module. With the regular expressions from the re module you can process strings. Examples Extract from the string >>> import re >>> re.findall(r'\bp[a-z]*','learn fast python language') ['python']...
Read and Write Files For reading and writing files with Python, first you need to use open function, inside the open function set the path of the file and then set the mode of the file. The mode can be ‘r’...
Exception Handling Exceptions occur during execution of a block when errors are detected and interrupt the normal execution of a code block. Python handle exceptions using the statement try…except, similar to the try…catch in Java. Examples Exception Handling using try except...