Akshitha Mote

Akshitha Mote

35 Articles Published

Articles by Akshitha Mote

Page 4 of 4

How do we reference Python class attributes?

Akshitha Mote
Akshitha Mote
Updated on 24-Mar-2026 984 Views

In Python, the variables that are declared inside a class are known as attributes. These attributes can be accessed and modified by both the class and its objects. There are two types of attributes ? Class Attributes: Variables defined at the class level that are shared among all instances of the class. They can be accessed using the class name or instance objects. Instance Attributes: Variables defined inside the __init__() method or other instance methods that are specific to each object. They are accessed using the object name. Accessing Class ...

Read More

How to write Python regular expression to match with file extension?

Akshitha Mote
Akshitha Mote
Updated on 24-Mar-2026 1K+ Views

Using Python, we can easily search for specific types of files from a mixed list of file names using regular expressions. For this, we need to import Python's built-in module called re using the import keyword. The Regular expression or Regex is a special sequence of characters like \, *, ^, etc, which are used to search for a pattern in a string or a set of strings. It can detect the presence or absence of characters by matching them with a particular pattern and can also split a string into one or more substrings. Importing the Regex ...

Read More

What is __init__.py in Python?

Akshitha Mote
Akshitha Mote
Updated on 24-Mar-2026 2K+ Views

In Python, __init__.py is a special file that makes a directory a Python package. When Python encounters a directory during import, it looks for the __init__.py file to determine how to initialize the package and what code should be executed. The __init__.py file serves two main purposes: It makes the directory a Python package so the interpreter can find modules inside It can contain package initialization code, such as importing submodules, defining variables, or executing setup code Package Structure with __init__.py Here's a typical package structure ? mypackage/ ...

Read More

What is difference between raw_input() and input() functions in Python?

Akshitha Mote
Akshitha Mote
Updated on 24-Mar-2026 907 Views

When working with user input in Python, developers often encounter two functions: input() and raw_input(). Understanding their differences is crucial for writing compatible code across Python versions. Python input() Function The input() function reads input from the user and returns it as a string. However, its behavior differs significantly between Python 2.x and Python 3.x versions. Python 3.x input() Behavior In Python 3.x, input() always returns a string, regardless of what the user enters ? num_1 = input("Enter value of num_1: ") num_2 = input("Enter value of num_2: ") print("Values are", num_1, num_2) print("Type ...

Read More

Getting console.log output from Chrome with Selenium Python API bindings.

Akshitha Mote
Akshitha Mote
Updated on 22-Jan-2025 6K+ Views

We can get console.log output from Chrome with Selenium Python API bindings. We will perform this with the DesiredCapabilities class. We shall enable logging from the browser with DesiredCapabilities.Chrome setting. We have to pass this browser capability to the driver object by passing it as a parameter to the Chrome class. To enable logging we shall set the property goog:loggingPrefs of the browser to 'browser':'ALL'. Syntax Syntax:dc = DesiredCapabilities.CHROME dc['goog:loggingPrefs'] = { 'browser':'ALL' } driver = webdriver.Chrome(desired_capabilities=dc) Example from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities #set browser log dc = DesiredCapabilities.CHROME dc['goog:loggingPrefs'] = { 'browser':'ALL' } driver ...

Read More
Showing 31–35 of 35 articles
« Prev 1 2 3 4 Next »
Advertisements