7

The documentation for Python 2.7 lists string.find as a deprecated function but does not (unlike atoi and atol) provide an alternative.

I'm coding in 2.7 at the moment so I'm happy to use it but I would like to know:

  • what is it going to be replaced with?
  • is that usable in 2.7 (if so, I'll use it now so as to avoid recoding later)?
2
  • What part of the documentation are you reading? Why are you using the string module? Commented Sep 15, 2010 at 2:41
  • Turns out the documentation I was reading was the wrong documentation. Serves me right for blindly following Google links without thinking. Thanks, all. Commented Sep 15, 2010 at 2:48

2 Answers 2

6

Almost the entire string module has been moved to the str type as method functions.

Why are you using the string module, when almost everything you need is already part of the string type?

http://docs.python.org/library/stdtypes.html#str.find

The string type -- and it's methods -- is not deprecated. Indeed, it will me morphed to include Unicode in Python 3.

Sign up to request clarification or add additional context in comments.

1 Comment

Because I program in Python about twice a year :-) But apologies to all, I am using the class, I just found the wrong doco. Stupid! Stupid! Stupid!
6

A lot of methods in string have been replaced by the str class. Here is str.find.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.