• [^] # Re: 2/3 idées

    Posté par . En réponse au message [RESOLU] [NOOB INSIDE] CONCATENER DES FICHIERS. Évalué à 1.

    >>> for year, range_ in byYear.items():
     start, end = range_
     with open('twic%s.pgn' % year, 'w') as outfile:
     for current_file in filter( lambda twic_name: start <= int(twic_name[4:-4]) <= end, my_sorted_twic_files ):
     with open(current_file) as infile:
     outfile.write(infile.read())
     outfile.write("\n")
    Traceback (most recent call last):
     File "<pyshell#32>", line 4, in <module>
     for current_file in filter( lambda twic_name: start <= int(twic_name[4:-4]) <= end, my_sorted_twic_files ):
    NameError: name 'my_sorted_twic_files' is not defined