redho home | products | services

Programming Forums


Community for Java, PHP, Perl C, ASP and Python programmers

Ask your IT question here

changing of a string



 
Post new topic   Reply to topic    Programming Forums -> Python programming forum
View previous topic :: View next topic  
Author Message
Klimapol
Enthusiastic Coder


Joined: 27 May 2006
Posts: 134
Hello, I have a list of strings and need change each string the same way, there are four different changes I need to apply. Right now I append each changed item to a new list. Is there a better way?

Reply with quote
 
autos06
Enthusiastic Coder


Joined: 13 May 2006
Posts: 123
Location: New York
Make a function for it, and map it over the list, e.g.: mylist = map(change, mylist)
Depending on the nature of changes, an LC/generator expression may be more appropriate.

Reply with quote
 
Klimapol
Enthusiastic Coder


Joined: 27 May 2006
Posts: 134
autos06, thank you I will try that.
Reply with quote
 
Page 1 of 1
Post new topic   Reply to topic    Programming Forums -> Python programming forum


Dubai Forums - Expat Help | Vegan Chat | Java Programming | Free 3D tutorials and 3d textures | Paris Forum | EU Forum
Free Dubai Classifieds | Free London Classifieds | Jobs in London

High Quality, Custom 3d animation and Web Design solutions Royal Quality Web Hosting Services Vegetarian and Animal Rights news

Powered by phpBB © 2001, 2005 phpBB Group