If you've got a string containing for example "how are you?", I would do stringname.replace("how", "How")
to have the first word written in Capital H.
So far so good.
The problem now is, I'm writing this script which at some point accesses the Open Weather Map, and the words are driving me crazy.
Until now I just did a
weather2 = self.weather.replace("partly", "Partly")
weather3 = weather2.replace("cloudy", "Cloudy")
weather4 = weather3.replace("foggy", "Foggy")
weather5 = weather4.replace("sunny", "Sunny")
weather6 = weather5.replace("rain", "Rain") #and so on
But I can't have 20 .replace()
.
So I was thinking, and here comes my question: Could I create two lists, one containing the OWM originals, and the other list with the Words it shall be replaced with, and do something like
for name in names
do something