>>> from votacions import votacions ---- inici >>> vots = """\ ... Cargol treu banya, El gripau blau, En Pinxo i en Panxo ... La lluna la pruna, En Pinxo i en Panxo, La pastoreta ... Cargol treu banya ... La lluna la pruna, El Ball de Sant Ferriol ... Plou i fa sol, La lluna la pruna ... La lluna la pruna, Plou i fa sol, En Jan petit ... """ >>> with open('vots_radio.txt', 'w') as f: a = f.write (vots) >>> votacions('vots_radio.txt', 'resultats.txt') >>> with open('resultats.txt', 'r') as f: ... sorted(f.readlines()) ['1*El Ball de Sant Ferriol\n', '1*El gripau blau\n', '1*En Jan petit\n', '1*La pastoreta\n', '2*Cargol treu banya\n', '2*En Pinxo i en Panxo\n', '2*Plou i fa sol\n', '4*La lluna la pruna\n'] ---- fi