Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Modifying Strings

Vinay Rawal answered on April 2, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • how to set a string
  • Constructing Strings with Variables
  • concatenating strings
  • Python - Modify Strings

  • Modifying Strings

    0

    Having such a data type as strings, you may reach an instance where you want to change or modify a particular variable to perhaps change a character at a particular location, remove a character or maybe just add one or a few.

    Coming from another programming language like C, you may assume the tendency to just do it using the string indexing as below.

    String[0] = "k"

    Though very intuitive, this does not work with python, because strings are a part of the data types that are immutable, and once created, cannot be modified.

    Plus, the assignment operator (=) is not supported by strings.

    Popularity 1/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Tags: whatever
    Link to this answer
    Share Copy Link
    Contributed on Apr 02 2023
    Vinay Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.