Iteration over strings

Jay Loden python at
Tue Jul 31 22:27:25 CEST 2007

Robert Dailey wrote:
> Hey,
> Thanks a lot for your answers guys. I had already known that strings are
> immutable, but having been a C++ programmer for years I'm still trying to
> get over the fact that it's not std::string :) The python documentation
> isn't that easy to navigate in my opinion, so I wasn't able to find the
> 'replace()' function you guys are talking about. It's actually the perfect
> solution for the problem.
> I appreciate your time.

I have to agree with you WRT to the Python documentation, it does tend to be lacking and difficult to find things at times. In this case the two ways I can think of to look for something like this would have been: 

	pydoc string

which lists the replace() method in the documentation for the string module, or to search Google for it. There are a lot of code samples out there for Python such as the online Python Cookbook: 

I also highly recommend Python in Nutshell, the Python Cookbook, or Programming Python (all O'Reilly books). Programming Python is a huge tome but like all O'Reilly books in the Programming X series, it is aimed at someone who's not necessarily new to programming but is new to the language. That in combination with lots of code samples might be best for you since you're familiar with programming and it's language specifics you need references for.

I'm sure there are other great books, those just happen to be the ones I'm familiar with :-)


More information about the Python-list mailing list