Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Commit a923058

Browse files
committed
Remove odd line-break
1 parent a0b1271 commit a923058

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

weather.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@ def GetForecastXML(locationCode):
1414

1515
def ExtractData(forecastXML):
1616
tree = ET.fromstring(forecastXML)
17-
resultString = tree.find('channel').find('title').text
17+
results = []
18+
results.append(tree.find('channel').find('title').text)
1819

1920
for day in tree.find('channel').findall('item'):
20-
resultString += '\n' + 'Observed at ' + day.find('pubDate').text
21+
results.append('Observed at ' + day.find('pubDate').text)
2122
for line in day.find('description').text.split(', '):
22-
resultString += '\n' + line.replace(u'\xb0','')
23+
if(results[-1][-2:] == 'mb'):
24+
results[-1] = results[-1] + ' ' + line.replace(u'\xb0','')
25+
else:
26+
results.append(line.replace(u'\xb0',''))
2327

24-
return resultString
28+
return '\n'.join(results)
2529

2630
def main():
2731
location = 'SO15'

0 commit comments

Comments
 (0)