String Operations
From Sustainability Methods
In Python, strings are a sequence of characters used to store and manipulate text. Python provides many built-in methods to perform common string operations, which are especially useful in data analysis for cleaning, transforming, and analyzing text data. Below are some of the most commonly used string operations.
1. Converting to Lowercase and Uppercase
You can convert a string to all lowercase or uppercase characters using the lower() and upper() methods.
text = "Wiki Methods" print(text.lower()) # Output: "hello world" print(text.upper()) # Output: "HELLO WORLD"
The output will be respectively:
wiki methods WIKI METHODS