
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33578 Articles for Programming

2K+ Views
While working with the strings in python, we will find the situations to break the string into parts. This is called splitting a string and is usually done based on a delimiter, this is nothing but a character or sequence of characters that separate the parts of the string. Python provides the several ways for achieving this, depending on whether the delimiter is simple string or a pattern. Let's dive into the article to learn more about splitting string by delimiter. Using python split() Method The python split() method is used to split the words in a string separated by ... Read More

4K+ Views
Any character or group of characters that depicts horizontal or vertical space is known as whitespace. A whitespace character usually takes up space on a page even though it does not correspond to any visible mark when it is rendered. Pressing the spacebar will allow you to enter a whitespace character. On many keyboards, the Tab key can also be used to enter horizontal whitespace, although the length of the space may vary. Any spaces or tabs that follow the final non-whitespace character on the line until the newline are considered trailing whitespace. Whitespace in Python Whitespace is a type ... Read More

615 Views
In python, Right-aligning the strings with space padding is a common requirement when formatting the text-based output such as reports, logs or tabular data. This can be done by using the built-in string methods. Let's dive into the article, to learn different ways to get a space-padded string with the original string right-justified in python. Using python rjust() Method The python rjust() method is used to right-align a string by padding it with a specified character on the left. Syntax Following is the syntax of python rjust() method − str.rjust(length, character) Example Let's look at the ... Read More

2K+ Views
I would suggest you to use below instead of JCO_AHOST and JCO_SYSNR:Use JCO_R3NAME with system ID of the target hostUse JCO_MSHOST with message server host name or IP addressUse JCO_MSSERV with message server port numberUse JCO_GROUP with the name of the logon groupYou can refer to below link to check a working example:https://sourceforge.net/p/rcer/git/ci/master/tree/net.sf.rcer.conn

4K+ Views
In this article, we are going to find out how to search a string in backward direction in Python. The first method is to use the inbuilt python String class's rindex() method. The highest index of any substring in the given string is returned by the Python string rindex() method. By highest index, we mean that if a given substring appears twice or three times in a string, the rindex() method will return the index of the substring's rightmost or final occurrence. The main disadvantage of this function is that it throws an exception if the string contains no substrings. ... Read More

14K+ Views
In Python, working with strings is a common task in data processing and text analysis. The common operation is finding the last occurrence of a specific substring. It is useful in situations like extracting the domain names or locating the repeated elements in logs. Python provides several methods to accomplish this; the most commonly used are − Python rfind() Method Python rindex() Method Using python rfind() Method The Python rfind() method is used to find the last occurrence of the substring in the given string; if not found, ... Read More

2K+ Views
In Python, you can replace all occurrences of a substring within a string using the replace() method. This method returns a new string where every occurrence of the given old substring is replaced with a new substring. To match the string with case-insensitivity, you need to use regular expressions. Using the replace() Method The Python replace() method returns a new string where all occurrences of the old substring are replaced with the new substring. It does not modify the original string because strings in Python are immutable. string.replace(oldvalue, newvalue, count) where, ... Read More

17K+ Views
Leading whitespace refers to any spaces, tabs, or other blank characters that appear at the start of a string. These characters come before the first visible text and can affect how the string is displayed. We can remove all leading whitespace from a string in Python using the lstrip() function. Using the lstrip() Function The lstrip() function removes all whitespace characters from the beginning (left side) of a string (leading whitespace). It does not affect any whitespace at the end or in the middle of the string. There are also two related functions i.e. rstrip() and strip() - ... Read More

4K+ Views
We can convert all uppercase letters in a string to lowercase in Python using the lower() function. You can also use a for loop or list comprehension to change each character to lowercase one by one. This is helpful when you want to compare strings without worrying about letter cases. Using lower() Function The Python lower() function returns a new string with all uppercase letters converted to lowercase, keeping the lowercase letters unchanged. It does not modify the original string and is commonly used when comparing strings or handling user input. Example In the following example, we convert an entire string ... Read More

3K+ Views
To find how many characters are present in a string (i.e. length of a string), Python provides the built-in function named len(). The length includes all characters in the string, including spaces, punctuation, and special characters. Using len() Function The len() function is the most direct way to find out how many characters are in a string. It returns the total number of characters, including spaces and special symbols. Example In the following example, we are calculating the length of a string using the len() function - text = "Python Programming" length = len(text) print("Length of the string is:", length) ... Read More