I have a function get_arcs():
for i in rng:
if not lines[i].startswith('[') and 'echo $ORACLE_SID' in lines[i].strip():
sid = lines[i + 2]
yield sid
if lines[i].strip().find('SELECT') == 0:
res = lines[i:]
for i in res:
print >> f, i.strip()
yield i.strip()
which supposed to:
- assign a certain value to variable sid
- write different content to f-file
- have the generator of i.strip() as the output which will be passed the to another function and the sum of certain objects will be calculated
The problem is when the get_arcs() is called:
for line in get_arcs():
if len(line.split()) == 13:
lst.append(int(line.split()[-5]))
print sum(lst), 'Bytes'
It does return the sum(lst) as expected, but how can I retrieve my sid value, as I cannot call it anywhere outside of the function.