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

  • Home
  • SEARCH
  • 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 7867633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:45:26+00:00 2026-06-03T00:45:26+00:00

How do I do this without string.count() , because it is listed as deprecated

  • 0

How do I do this without string.count(), because it is listed as deprecated in Python v2.7.3 documentation?

I am unable to find what I should use instead.

EDIT: The question originally stated that str.count() was deprecated but that is incorrect and misleading. See https://stackoverflow.com/a/10385996/966508 for explanation

  • 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-06-03T00:45:27+00:00Added an answer on June 3, 2026 at 12:45 am

    Use str.count() – it’s not listed as deprecated.

    (Python 2.7.3, Python 3.2.3 – both have no notes about being deprecated).

    >>> "test".count("t")
    2
    

    I’ll presume you meant string.count() – which is depreciated in favour of the method on string objects.

    The difference is that str.count() is a method on string objects, while string.count() is a function in the string module.

    >>> "test".count("t")
    2
    >>> import string
    >>> string.count("test", "t")
    2
    

    It’s clear why the latter has been deprecated (and removed in 3.x) in favour of the former.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a table without a primary key Like this: private static final String
my string is: [{property:surname,direction:ASC}] can I get GSON to deserialise this, without adding to
It is hard to find a resource on this without finding Java EE, but
How can I do this without having a million if then statements?
Can I do this without reference to the object in the constructor? In other
I have done this without much effort on T-SQL, but I want to implement
Can I do this without Javascript? Here is the mock markup.. <div id=parent> <div
Is it possible to somehow do this without taking out the @? It does
My navbar doesn't line up in IE... how can I fix this without using
I tried this aproach without any success the code I'm using: // File name

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.