Gireesha Devara has Published 248 Articles

Python program to convert XML to Dictionary

Gireesha Devara

Gireesha Devara

Updated on 29-Aug-2023 14:12:09

3K+ Views

The Extensible Markup Language (XML) is a widely used format for representing structured information. It is a markup language that allows us to define our own tags to describe the data and its structure. XML is designed to be both human-readable and machine-readable. It uses opening and closing tags to ... Read More

Python Program to convert Dictionary to List by Repeating keys corresponding value times

Gireesha Devara

Gireesha Devara

Updated on 29-Aug-2023 14:10:32

143 Views

In Python, dictionaries are key-value pairs where each key is associated with a corresponding value. When we want to convert a dictionary to a list by repeating keys, we need to iterate over each key-value pair and repeat the key based on its corresponding value. Input Output Scenarios See the ... Read More

Python program to convert Dict of list to CSV

Gireesha Devara

Gireesha Devara

Updated on 29-Aug-2023 14:07:37

2K+ Views

In a dictionary, keys must be unique and immutable, while values can be of any type and can have a list of values. In the case of a dictionary of lists, each key points to a list that can contain multiple elements.  Here's an example of a dictionary of lists ... Read More

Python program to Count Uppercase, Lowercase, special character and numeric values using Regex

Gireesha Devara

Gireesha Devara

Updated on 29-Aug-2023 14:05:18

851 Views

Regular expressions, commonly known as re or Regex is a powerful tool for manipulating and searching for patterns in text. In Python, regular expressions are implemented using the re-module. A regular expression is a sequence of characters that define a search pattern. The pattern is used to match and manipulate ... Read More

How to check the data type in pandas DataFrame?

Gireesha Devara

Gireesha Devara

Updated on 29-Aug-2023 07:20:28

212K+ Views

To check the data type in pandas DataFrame we can use the "dtype" attribute. The attribute returns a series with the data type of each column.And the column names of the DataFrame are represented as the index of the resultant series object and the corresponding data types are returned as ... Read More

How to know if an object has an attribute in Python?

Gireesha Devara

Gireesha Devara

Updated on 29-Aug-2023 03:41:46

23K+ Views

Python is an object-oriented programming language, here attributes are known as properties of an object. By using different methods, we can check if an object has an attribute or not. To check if an object contains a particular attribute then we can use hasattr() method and getattr() method. Or if ... Read More

How to wrap python object in C/C++?

Gireesha Devara

Gireesha Devara

Updated on 24-Aug-2023 16:01:06

531 Views

To wrap existing C or C++ functionality in Python, there are number of options available, which are: Manual wrapping using PyMethodDef and Py_InitModule, SWIG, Pyrex, ctypes, SIP, Boost.Python, and pybind1. Using the SWIG Module Let’s take a C function and then tune it to python using SWIG. The SWIG stands ... Read More

How we can update a Python tuple element value?

Gireesha Devara

Gireesha Devara

Updated on 24-Aug-2023 15:52:50

1K+ Views

Python tuple is an immutable object, which means once tuple is created you cannot change, update, add, or remove its values. If we try to update any of its elements, then it will throw the TypeError. In this article, we will use three different ways like list conversion, slicing, packing, ... Read More

How to create Python objects based on an XML file?

Gireesha Devara

Gireesha Devara

Updated on 24-Aug-2023 12:45:36

2K+ Views

XML (Extensible Markup Language), which is a markup−language that is used to structure, store, and transfer data between systems. At some point we need to read/write the XML data using the Python language. By using the untangle library we can create Python objects based on an XML file. The untangle ... Read More

Is there any Python object inspector?

Gireesha Devara

Gireesha Devara

Updated on 23-Aug-2023 19:09:55

456 Views

In python there is no built−in or normal function that acts as an object inspector. But we can use functions like type(), help(), dir(), vars() or modules like inspect are used to find the attributes, properties and methods of any object. Also we have other functions like id(), getattr(), ... Read More

Advertisements