Devnote

Web Development Blog Company, Services India

MySQL Error 121 Duplicate key on write - Practical Repair Strategy
MySQL Error 121 Duplicate key on write – Practical Repair Strategy
February 13, 2026
PHP cURL error 60: SSL certificate problem - Windows & Linux Fix
PHP cURL error 60: SSL certificate problem – Windows & Linux Fix
February 11, 2026
Fix localhost refused to connect After Installing XAMPP / WAMP
Fix “localhost refused to connect” After Installing XAMPP / WAMP
February 9, 2026
Composer Error Memory exhausted When Installing Packages - Real Fix
Composer Error: Memory exhausted When Installing Packages – Real Fix
February 6, 2026
MySQL 8 Error Unknown collation: utf8mb4_0900_ai_ci - Safe Migration Guide
MySQL 8 Error Unknown collation: utf8mb4_0900_ai_ci – Safe Migration Guide
February 4, 2026
Devnote

Type and hit Enter to search

  • Home
  • Laravel
    • Auth
    • Migration
    • DATATABLE
    • Yajra
  • wordpress
    • plugin
    • WPBakery
    • woocommerce
  • PHP
    • MYSQL
    • Ajax
  • Blog
  • Informational
    • About us
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
  • Contact US
Devnote
  • Home
  • Laravel
    • Auth
    • Migration
    • DATATABLE
    • Yajra
  • wordpress
    • plugin
    • WPBakery
    • woocommerce
  • PHP
    • MYSQL
    • Ajax
  • Blog
  • Informational
    • About us
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
  • Contact US
Python String Methods

Python string methods

Image
Devnote team
May 28, 2020
One Min Read
1.1K Views
0 Comments

Python built-in methods that allow us to easily modifications to strings. In this tutorial we will cover the python string methods : upper(), lower(), count(), find(), replace() and str() methods.

String Methods

upper() and lower()

The upper() method on a string converts all of the characters to uppercase. and the lower() method converts all of the characters to lowercase.

>>> str = "Python String Methods"
>>> str.upper()
output : 'PYTHON STRING METHODS'

>>> str.lower()
output : 'python string methods'

count()

The count() technique includes the occasions a character or succession of characters shows up in a string

>>> str = "Python String Methods"
>>> str.count("o")
output : 2

find()

We search for a specific character or characters in a string with the find() method.

>>> str = "Python String Methods"
>>> str.find("Methods")
output : 14

The results tell us that Methods begins at the 14th position in the sequence.

>>> str.find("o")
output : 4

But if we want to find the second “o” we need to specify a range.

>>> str.find("o", 5)
output : 18

replace()

We want to increase the value of a statement. We do so with the replace() method.

>>> str = "Python String Methods"
>>> str.replace("Methods", "Method")
output : 'Python String Method'

len()

And utilize the implicit Python technique, len(), to get the length of any unordered, sequence or ordered.

>>> str = "Python string methods"
>>> len(str)
output : 21

Categories:

djangopython

Other Articles

How to get current date and time in python
Previous

How to get the current date and time in python?

How to disable Laravel debugger
Next

How to disable Laravel debugger

No Comment! Be the first one.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related Posts

How to Set Up Google Authentication with Django

How to Set Up Google Authentication with Django

February 17, 2021
How to make a field read-only in Django admin

How to make a field read-only in Django admin?

February 9, 2021
How to disable admin pagination in Django?

How to disable admin pagination in Django?

February 5, 2021
How to show the larger number on the listview page?

How to show the larger number on the listview page?

February 4, 2021
Devnote

Devnote provides a collection of tutorials about PHP, Laravel, WordPress, Django, MySQL, Bootstrap, Jquery, Ajax, APIs, CRUD operations, etc.

Devnote © , All Rights Reserved.

Page Links

  • Home
  • About us
  • Blog
  • Contact US
  • Site map

Category

  • PHP
  • Laravel
  • wordpress
  • HTML
  • jQuery

Follow Us

Facebook Instagram Twitter Youtube Linkedin Pinterest
Morbi, Gujarat, India - 363641
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT
Advertisement