• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » Python » String Functions in Python
Next →
← Prev

String Functions in Python

By Dinesh Thakur

String functions in Python are used to modify information with a string or query. Python has a string data type that has several string functions that handle strings directly.

We’ll be covering the following topics in this tutorial:

  • Built-in String Methods
  • Python String capitalize()
  • Python String center()
  • Python String count()
  • Python String encode()
  • Python String endswith()
  • Python String expandtabs()
  • Python String find()
  • Python String index()
  • Python String isalnum()
  • Python String isalpha()
  • Python String isdecimal()
  • Python String isdigit()
  • Python String islower()
  • Python String isnumeric()
  • Python String isspace()
  • Python String istitle()
  • Python String isupper()
  • Python String join()
  • Python String ljust()
  • Python String lower()
  • Python String lstrip()
  • Python String maketrans()
  • Python String replace()
  • Python String rfind()
  • Python String rindex()
  • Python String rjust()
  • Python String rstrip()
  • Python String split()
  • Python String splitlines()
  • Python String startswith()
  • Python String strip()
  • Python String swapcase()
  • Python String title()
  • Python String translate()
  • Python String upper()
  • Python String zfill()

Built-in String Methods

In this tutorial, you can learn Python string functions. Python has many built-in functions to manipulate strings and character values.

Note: Python String is immutable, so string methods return new values. They do not change the original string.

This section describes built-in method for converting a string of characters to its applicable new string.

Python String capitalize()

  returns a string copy with only its first character capitalized.

Python String center()

  aligns the string center with the string’s left and right padding

Python String count()

   returns all the old substring occurrences with the new substring

Python String encode()

  returns encoded string of given string

Python String endswith()

  returns True if the string ends with the specified suffix

Python String expandtabs()

   returns a copy of the string in which tab characters ie. ‘\t’ are expanded using spaces

Python String find()

  returns the first matched index of the substring

Python String index()

   Returns Index of Substring

Python String isalnum()

   tests whether or not all characters are alphanumeric

Python String isalpha()

   returns true if all the string characters are alphabets

Python String isdecimal()

   Checks all the characters in the string are decimal

Python String isdigit()

  returns True if all the characters are digits

Python String islower()

   returns True if all string characters are in lowercase

Python String isnumeric()

   checks whether the string consists of only numeric characters

Python String isspace()

  returns true if there are only whitespace characters in the string

Python String istitle()

  tests and returns True if the only first character of each word is uppercase

Python String isupper()

  checks whether all the case-based characters (letters) of the string are uppercase

Python String join()

  used to join separator items to the input string

Python String ljust()

   returns a left-justified string and fills the remaining spaces with specified fillchar

Python String lower()

  returns the lowercased string from the given string

Python String lstrip()

  returns a copy of the string in which all chars have been stripped from the beginning of the string

Python String maketrans()

  returns a mapping table that maps every character in the intabstring in the same place in the outtab string

Python String replace()

  returns all the old substring occurrences with the new substring

Python String rfind()

   returns the index of the string’s rightest matched substring

Python String rindex()

  returns the last index of the substring inside the string

Python String rjust()

  returns the right-justified string and fill the remaining spaces with specified fillchar

Python String rstrip()

   returns a copy of the string in which all chars have been stripped from the end of the string

Python String split()

  returns a comma-separated list, using separator delimiter

Python String splitlines()

  returns a list with all the lines in string, optionally including the line breaks.

Python String startswith()

  returns True if the string starts with the specified prefix, otherwise False.

Python String strip()

  returns a copy of the string by stripping both the beginning and the string’s end

Python String swapcase()

  transforms the case of uppercase string characters to lowercase and vice versa

Python String title()

  returns a copy of the string in which first characters of all the words are capitalized

Python String translate()

  returns a copy of the string in which a specified translation table is used to map each character

Python String upper()

  transforms all lowercase characters into uppercase and returns an uppercase string

Python String zfill()

  returns the copy of the string with 0 on the left

You’ll also like:

  1. Python String Variables
  2. Python String split() Method
  3. Python String center() Method
  4. Python String isnumeric() Method
  5. Python String endswith() Method
Next →
← Prev
Like/Subscribe us for latest updates     

About Dinesh Thakur
Dinesh ThakurDinesh Thakur holds an B.C.A, MCDBA, MCSD certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps.

Dinesh Thakur is a Freelance Writer who helps different clients from all over the globe. Dinesh has written over 500+ blogs, 30+ eBooks, and 10000+ Posts for all types of clients.


For any type of query or something that you think is missing, please feel free to Contact us.


Primary Sidebar

Python

Python Tutorials

  • Python - Home
  • Python - Features
  • Python - Installation
  • Python - Hello World
  • Python - Operators Types
  • Python - Data Types
  • Python - Variable Type
  • Python - Switch Case
  • Python - Line Structure
  • Python - String Variables
  • Python - Condition Statement
  • Python - if else Statement
  • Python - for-loop
  • Python - while loop
  • Python - Command Line
  • Python - Regular Expression

Python Collections Data Types

  • Python - List
  • Python - Sets
  • Python - Tuples
  • Python - Dictionary

Python Functions

  • Python - Functions
  • Python - String Functions
  • Python - Lambda Function
  • Python - map() Function

Python Object Oriented

  • Python - Oops Concepts
  • Python - File Handling
  • Python - Exception Handling
  • Python - Multithreading
  • Python - File I/O

Python Data Structure

  • Python - Linked List
  • Python - Bubble Sort
  • Python - Selection Sort
  • Python - Linear Search
  • Python - Binary Search

Python Programs

  • Python - Armstrong Number
  • Python - Leap Year Program
  • Python - Fibonacci Series
  • Python - Factorial Program

Other Links

  • Python - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW