- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Rajendra Dharmkar has Published 453 Articles
Rajendra Dharmkar
817 Views
To check if a string or a substring of a string ends with a suffix in Python, there are several ways to accomplish this. Here are some examples: Using the endswith() Method The endswith() method checks if the string ends with a specified suffix and returns a boolean value. To ... Read More
Rajendra Dharmkar
215 Views
A substring is a contiguous sequence of characters within a string. In other words, it's a smaller piece of text that appears within a larger piece of text. For example, in the string "lorem ipsum", the substring "lorem" appears within the larger string. Similarly, the substring "em i" appears within ... Read More
Rajendra Dharmkar
696 Views
ASCII stands for American Standard Code for Information Interchange. ASCII is a character encoding system that assigns a unique number to each letter, digit, and symbol on a standard keyboard. In Python, each character has a numerical value based on the ASCII code, which can be checked using the ord() ... Read More
Rajendra Dharmkar
8K+ Views
To check if a Python string contains only digits, we can use the built-in isdigit() method. This method returns True if all the characters in the string are digits, and False otherwise. Here's an example code snippet that demonstrates how to use isdigit(): To check if a string contains only ... Read More
Rajendra Dharmkar
6K+ Views
Here are three code examples that demonstrate how to check if a character in a string is a letter in Python: Using the isalpha() method The isalpha() method is a built-in method in Python that returns True if all the characters in a string are alphabets (letters) and False otherwise. ... Read More
Rajendra Dharmkar
2K+ Views
To wrap a string in a file in Python, you can follow these steps: Open a file in write mode using the open() function and assign it to a variable. Call the write() function on the file variable and pass the string you want to wrap as an argument. This ... Read More
Rajendra Dharmkar
280 Views
Python modules are essentially just files containing Python code that can be imported and used in other Python programs. Here's an explanation with some code examples: Basic Module Example Let's create a simple module called my_module.py. We can define a function in this module called hello() which prints a ... Read More
Rajendra Dharmkar
2K+ Views
In Python 3, the input() function always returns a string, even if the user enters a number. To check if the user input is an integer, you can use a try-except block and attempt to convert the input string to an integer using the int() function. Here are some code ... Read More
Rajendra Dharmkar
4K+ Views
In Python, you can un-escape a backslash-escaped string using the decode() method or by using the ast module. Here are few different ways to do it: Using decode() method Example In this method, we define a string called escaped_string that contains a backslash-escaped newline character . We convert this string ... Read More
Rajendra Dharmkar
936 Views
To check if a string has alphabets or numbers in Python, we can use some built-in methods like isalpha() and isdigit(). isalpha() returns True if all characters in a string are alphabets (letters), and False otherwise. isdigit() returns True if all characters in a string are digits (numbers), and False ... Read More