Re: Iteration over strings



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:

http://aspn.activestate.com/ASPN/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 :-)

-Jay
.



Relevant Pages

  • Re: Strings, arrays and efficiency
    ... Lewis Perin wrote: ... String concatenation will be among the very least of your problems. ... Then, and only then, if you have performance problems, find the real problem and fix it. ...
    (comp.lang.php)
  • Re: Strings, arrays and efficiency
    ... Lewis Perin wrote: ... PHP is not Python. ... between adding to a string and adding to an array. ...
    (comp.lang.php)
  • Re: Strings, arrays and efficiency
    ... Lewis Perin writes: ... between adding to a string and adding to an array. ...
    (comp.lang.php)
  • Re: Strings, arrays and efficiency
    ... language is a terrible idea from the standpoint of frequent memory ... PHP is not Python. ... between adding to a string and adding to an array. ...
    (comp.lang.php)
  • Re: Strings, arrays and efficiency
    ... Lewis Perin wrote: ... PHP is not Python. ... between adding to a string and adding to an array. ...
    (comp.lang.php)