3. Exception Handling
In any programming language there are 2 types of errors are possible.
- Syntax Errors
- Runtime Errors
In any programming language there are 2 types of errors are possible.
search pattern
string contains
the specified search pattern.re
, which can be used to work with Regular Expressions.If we want to represent a group of Strings according to a particular format/pattern then we should go for Regular Expressions.
[Read More]As the part of programming requirement, we have to store our data permanently for future purpose. For this requirement we should go for files.
Files are very common permanent storage areas to store our data.
There are 2 types of file
Text Files
Binary Files
interaction between
the user
and the operating system
import os
# shows all attribute and method in this module.
print(dir(os))
[Read More]
UTC, or Coordinated Universal Time, is the primary time standard by which the world regulates date and time.
astimezone()
–> it helps to convert the time of a particular time zone into another time zonelocaltime()
–> it helps to get the current local timeThe datetime classes are categorize into 6 main classes –
year
, month
and day
hour
, minute
, second
, microsecond
and tzinfo
Dictionaries are used to store data values in key-value pairs
Duplicate
keys are not allowed but values can be duplicated.Hetrogeneous
objects are allowed for both key and values.Insertion order
is not preservedmutable
Indexing and slicing
concepts are not applicableAs of Python version 3.7, dictionaries are ordered. In Python 3.6 and earlier, dictionaries are unordered.
[Read More]If a group of statements is repeatedly required then it is not recommended to write these statements everytime separately.
We have to define these statements as a single unit, and we can call that unit any number of times based on our requirement without rewriting. This unit is nothing but function.
code Reusability
.Tuple is exactly same as List except that it is immutable. i.e once we creates Tuple object,we cannot perform any changes in that object. Hence Tuple is Read Only version of List
.
immutable
and insertion order is preserved
Duplicates
and Heterogeneous
objects are allowedList is used when we want to represent a group of values
as a single entity where insertion order
required
to preserve and duplicates are allowed
then we should go for list data type
most frequently used
and very versatile data types used in Python.ordered
, mutable
, heterogeneous
and allow duplicate values
.indexed
, the first item has index [0]
, the second item has index [1]
etc.