Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7611305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:38:18+00:00 2026-05-31T01:38:18+00:00

While I know that there is the possibility: >>> a = abc >>> result

  • 0

While I know that there is the possibility:

>>> a = "abc"
>>> result = a[-1]
>>> a = a[:-1]

Now I also know that strings are immutable and therefore something like this:

>>> a.pop()
c

is not possible.

But is this really the preferred way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:38:19+00:00Added an answer on May 31, 2026 at 1:38 am

    Strings are “immutable” for good reason: It really saves a lot of headaches, more often than you’d think. It also allows python to be very smart about optimizing their use. If you want to process your string in increments, you can pull out part of it with split() or separate it into two parts using indices:

    a = "abc"
    a, result = a[:-1], a[-1]
    

    This shows that you’re splitting your string in two. If you’ll be examining every byte of the string, you can iterate over it (in reverse, if you wish):

    for result in reversed(a):
        ...
    

    I should add this seems a little contrived: Your string is more likely to have some separator, and then you’ll use split:

    ans = "foo,blah,etc."
    for a in ans.split(","):
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ist there a possibility to do something like that: int selected_value = Dialog(This dialog
Now while I know that you can not perform inheritance like you would in
What are some key UI design tips that every developer should know? While there
I have played around with Scala for a while now, and I know that
Also I want to know how to add meta data while indexing so that
I was always curious is there any possibility to overload function literal, something like
I wanted to know after I initialize a combobox, is there a possibility that
hi all i want to know that while specifying url in my iphone native
In .NET is there a way to enable Assembly.Load tracing? I know while running
want to know why String behaves like value type while using ==. String s1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.