当我将机场设置为一个变量时,我可以获得文本文件。但是,如何获取多个机场代码的文本文件并显示信息?
airport = 'KSFO, KSJC, KOAK'
for metar in urlopen('http://weather.noaa.gov/pub/data/observations/metar/stations/%s.TXT' %airport):
metar = metar.decode("utf-8")
if "%s" %airport in metar:
print metar