Merge multiple python dictionaries

In this python article we are going to see, How to merge two or more dictionaries? There are many different ways to merge multiple dictionaries and here we are going to cover few of them. There are certain advantages of each way of merging so let’s them one by one. Python Dictionary update method. Converting dictionaries into individual list objects and then adding them. Using python ** dictionary unpacking operator. Merge dictionaries using dictionaries update() method. # Create two dictionary.Dictionary_1 = {‘a’:1, ‘b’:2}Dictionary_2 = {‘b’:10, ‘c’:11}#

Read More

Python string count() method.

In this article we are going to learn python string count() method which is associated with python string data type. Python string count method is used to count the number of occurrences of sub-string in a string. Basically it counts the number of overlapping occurrences of a sub-string. It searches the sub-string in a given string and returns how many times the sub-string is repeated. String count method in python is useful to find out how many times a specific character or a word or a

Read More

Python list comprehension along with examples

In this article, We are going to learn how list comprehension works along with its examples. So basically Python List comprehension is a simple and elegant way of creating a list in python. It returns us a new list after performing specified operation on each element of iterable (List or sequence). List comprehension requires a input list and operation statement. During the execution of program it takes each element of input list and will perform specified operation on that element. Output after performing operation will be

Read More

Python String Split method

In this article we are going learn about how python split method is used to split the string and produce a list. What is the syntax of python split. Sometimes we may want to break the long string and convert it into a small segments of strings. Python split is an action opposite to the string concatenation i.e in string concatenation we join multiple strings into one. Whereas using python split we can break the string into required segments. This purpose can be served using built-in

Read More