En effet, c'est dur de faire mieux et plus simple que shutil!!!! :)

Lamine

2011/9/10 Karl Dubost <[email protected]>

> Alioune,
> la syntaxe correcte est:
>
> # copy file with python
> def copy(s,d):
>    try:
>        s=open(s,'r')
>        d=open(d,'w')
>        d.write(s.read())
>    finally:
>        s.close()
>        d.close()
>
> Mais probablement il est plus simple et plus court d'utiliser shutil qui
> fait partie de la librairie standard ;)
> http://docs.python.org/library/shutil.html?highlight=shutils#shutil.copy
>
>
> from shutil import copy
> copy(s,d)
>
>
> --
> Karl Dubost
> Montréal, QC, Canada
> http://www.la-grange.net/karl/
>
>
> --
> Ce message a été envoyé à la liste [email protected]
> Gestion de votre abonnement : http://dakarlug.org/liste
> Archives : http://news.gmane.org/gmane.org.user-groups.linux.dakarlug
> Le site du DakarLUG : http://dakarlug.org
>
--
Ce message a été envoyé à la liste [email protected]
Gestion de votre abonnement : http://dakarlug.org/liste
Archives : http://news.gmane.org/gmane.org.user-groups.linux.dakarlug
Le site du DakarLUG : http://dakarlug.org

Répondre à