Zanon Samuele ha scritto: > [...] > def list_files( path = base_path ): > path_collection = [] > for dirpath, dirnames, filenames in os.walk( path ): > for file in filenames: > fullpath = os.path.join( dirpath, file ) > path_collection.append( fullpath ) > > return path_collection >
Piccolo consiglio; non c'è necessità di accumulare i path dei files in una lista. Puoi usare un generatore: def list_files( path = base_path ): for dirpath, dirnames, filenames in os.walk( path ): for file in filenames: fullpath = os.path.join( dirpath, file ) yield fullpath Questa versione dovrebbe essere più efficiente, specialmente se hai molti files. > [...] Ciao Manlio _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python