Oct-09-2019, 07:21 PM
(Oct-09-2019, 06:57 PM)tantony Wrote: How can I get only the integers from this?
import re w = 'KTPA 081653Z 00000KT 10SM BKN022TCU BKN040 OVC001RMK 28/23 A2990 FEW070 RMK AO2 SLP125 TCU SCT080 NW-NE T02830228' k = re.findall("(FEW|SCT|BKN|OVC)(\d{3})", w) lst = [int(i[1]) for i in k] print(lst)
Output:[22, 40, 1, 70, 80]