web hosting and development forums
Web Design and Development Forums Archive


Index - Python programming forum

changing of a string


Post reply

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?
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.
autos06, thank you I will try that.




Dubai Forum | Paris Forum | Webmaster Forum | Vegan Forum | Brisbane Forum | 3D Forum | Jobs in Dubai | Jobs in London | London UK Classifieds
Archive script by RedHo.com