Tina I wrote:
> Hi everyone,
> 
> I have a small, probably trivial even, problem. I have the following HTML:
>> <b>
>>  METAR:
>> </b>
>> ENBR 270920Z 00000KT 9999 FEW018 02/M01 Q1004 NOSIG
>> <br />
>> <b>
>>  short-TAF:
>> </b>
>> ENBR 270800Z 270918 VRB05KT 9999 FEW020 SCT040
>> <br />
>> <b>
>>  long-TAF:
>> </b>
>> ENBR 271212 VRB05KT 9999 FEW020 BKN030 TEMPO 2012 2000 SNRA VV010 
>> BECMG 2124 15012KT
>> <br />
> 
> I need to make this into a dictionary like this:
> 
> dictionary = {"METAR:" : "ENBR 270920Z 00000KT 9999 FEW018 02/M01 Q1004 
> NOSIG" , "short-TAF:" : "ENBR 270800Z 270918 VRB05KT 9999 FEW020 SCT040" 
> , "long-Taf:" : "ENBR 271212 VRB05KT 9999 FEW020 BKN030 TEMPO 2012 2000 
> SNRA VV010 BECMG 2124 15012KT"}
> 
> I have played around with BeautifulSoup but I'm stuck at stripping off 
> the tags and chop it up to what I need to put in the dict. If someone 
> can offer some hints or example to get me going I would greatly 
> appreciate it.
> 
> Thanks!
> Tina
Forgot to mention that the "METAR:", "short-TAF", and "long-TAF" is 
always named as such wheras the line of data ("ENBR 271212 VRB05KT 9999 
FEW020 BKN030 TEMPO 2012 2000 SNRA VV010 ") is dynamic and can be 
anything...

Tina
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to