>>> def cave(s):
result = None
for c in s:
if c.isdigit():
result = (result or 0)*10+ord(c)-ord('0')
else:
if result is not None:
yield result
result = None
if c==".":
break
>>> list(cave("gh8k23locsm08.dfkjc999"))
[8, 23, 8]
>>> def cave(s):
result = None
for c in s:
if c.isdigit():
result = (result or 0)*10+ord(c)-ord('0')
else:
if result is not None:
yield result
result = None
if c==".":
break
>>> list(cave("gh8k23locsm08.dfkjc999"))
[8, 23, 8]
source = [int(i) for i in raw_input().split(".")[0] if i.isdigit()]
sypper-pitТак у автора же
coni-lole
а 0 куда делся :)
source = [int(i) for i in raw_input().split() if ord(i) in ]
>>> list(cave("gh8k23locsm08.dfkjc999"))
[8, 23, 8]