Re: [Python] Richiamare funzione componendo il nome

2012-09-10 Per discussione Josef Eschgfaeller
'%s%d()' %(prefisso,n) -- # Esempio: def f1 (): print('f1') def f2 (): print('f2') def g (): print('g') def h (): print('h') funzioni=[f1,f2,g,h] for f in funzioni: f() for n in [1,2]: exec('f%d()&#

Re: [Python] togliere spazi finali da ogni singola riga di un testo

2012-09-02 Per discussione Josef Eschgfaeller
import re testo=re.sub(r'(?m) +$','',testo) -- Oppure decomporre in righe, applicare rstrip a ogni riga e ricongiungere con ''.join. Josef Eschgfaeller 2012/9/2, Federico Bruni : > Buongiorno a tutti > &