Skip to main content

Python String Methods

Python String methods are used to manipulate strings. While we are creating a string varible, a Python string object is created for storing the string values. A string is a sequences of chracters. Anything within the quotes is considered as a string. we can use single or double quotes.

The Python tutorial on Techtuts provides an information about Python and Python 3 from the basis to high level. This tutorial provides a good understanding about the Python and Python for Technical, Non-Technical People, College Students and Working Professionals. Given examples are an easy to write and simple to practice by yourself.

Python string methods

In this tutorial you will learn about the  Python and Python3. This tutorial includes  an Introduction, Python Environment Setup, Variables, Data types , Control flow Statements, Loops, Functions, Data Structures, Modules ,Files, Classes, Python Web Frameworks etc.

In our previous tutorial, Hope you have learned about the python strings and string data types. Here you are going to learn about python string methods. Python has lot of methods to simplify and manupilate the string operations. we can see one by one.

Python string case conversion

If  you are want to change the case of the give string. The python has the following methods. By tusing the following methods you can convert given string to your desired  case of the strings

Title case

What is title case?

The title case means first letter of the word is capitalized. 

You can change your given strings to title case by title() string method. You can understand the title case by using  the following example

>>> title_case="techtuts online python tutorial"
>>> print(title_case.title())
Techtuts Online PythonTutorial

Lower case

What is lower case?

The lower case each letter of the word is in small letter. ex:- a,b,c etc...

You can change your given strings to lower case by lower() string method. You can understand the lower case by using  the following example

>>> lower_case ="Techtuts Online Python Tutorial"
>>> print(lower_case.lower())
techtuts online python tutorial

Upper case

What is upper case?

The  upper case means each letter of the word is in capital letter. ex:- A,B,C etc...

You can change your given strings to upper case by upper() string method. You can understand the upper case by using  the following example.

>>> upper_case="Techtuts Online Tutorial"
>>> print(upper_case.upper())
TECHTUTS ONLINE TUTORIAL