[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: xml2fileditestosemplice



un tentativo sporco in python, passagli il file come standard input:

#!/usr/bin/env python
import sys,string
for i in sys.stdin:
  if string.find(i, 'Studente Matricola')!=-1:
    matricola = i[string.find(i, '"')+1:string.find(i, '" ')]
  elif string.find(i, 'Nome')!=-1:
    nome = i[string.find(i, '>')+1:string.rfind(i, '<')]
  elif string.find(i, 'Cognome')!=-1:
    print nome+'\t'+i[string.find(i, '>')+1:string.rfind(i,
'<')]+'\t'+matricola



Reply to: