ecco a lei ;) >>> for x in os.listdir('.'): ... if x is not '.' or x is not '..': ... print x
Questo, per stampare le directory in wd. Come puoi notare, scrivere Python รจ una bellezza, anche mamma saprebbe dirmi cosa fa " if x is not '.' or x is not '..' " ;) Un saluto Chiedi se hai altre domande! Dan Il giorno 26 giugno 2011 10:38, Freeze NorthPole <freeze...@gmail.com> ha scritto: > ciao, > e come faccio ad escludere le due directory? > Grazie Mille > > ps. cmq con il consiglio di Marco ho risolto con l'errore :) > > 2011/6/26 Daniel Pyrathon <piro...@gmail.com>: > > quando elenchi i file, miraccomando escludi '..' e '.' che si riferiscono > > alla directory precedente e a quella stessa ;) > > Se escludi questi non penso dovresti avere OSError. > > Facci sapere > > Dan > > > > Il giorno 26 giugno 2011 05:26, Marco Mariani <bir...@gmail.com> ha > scritto: > >> > >> try: > >> dim = os.path.getsize(list[i]) > >> except OSError: > >> dim = 0 > >> > >> > >> Nota che WindowsError eredita da OSError, usando except con > quest'ultimo, > >> catturi entrambi i casi. > >> > >> E cambia nome alla variabile 'list', non si riassegnano i nomi degli > >> oggetti builtin se non ci sono ottimi motivi. > >> > >> > >> > >> _______________________________________________ > >> Python mailing list > >> Python@lists.python.it > >> http://lists.python.it/mailman/listinfo/python > >> > > > > > > > > -- > > ************* > > PirosB3 > > http://pirosb3.com > > > > _______________________________________________ > > Python mailing list > > Python@lists.python.it > > http://lists.python.it/mailman/listinfo/python > > > > > _______________________________________________ > Python mailing list > Python@lists.python.it > http://lists.python.it/mailman/listinfo/python > -- ************* PirosB3 http://pirosb3.com
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python