Ciao, Prova Con:

import os
    if os.name == "posix":
        # Unix/Linux/MacOS/BSD/etc
        os.system('clear')
    elif os.name in ("nt", "dos", "ce"):
        # DOS/Windows
        os.system('CLS')
    else:
        # Fallback for other operating systems.
        print '\n' * numlines


Lorenzo Macchiavelli


Il giorno 22 marzo 2010 12.29, Sandro Tosi <[email protected]> ha
scritto:

> 2010/3/22 stefano664 <[email protected]>:
> > "Come faccio una
> > routine per capire da che sistema operativo sto interpretando il
> codice?".
>
> $ ipython
>
> In [1]: import platform
>
> In [2]: platform.system()
> Out[2]: 'Linux'
>
> spero che su win ritorni "Windows" (non ho macchine dove provare).
>
> Ciao,
> --
> Sandro Tosi (aka morph, morpheus, matrixhasu)
> My website: http://matrixhasu.altervista.org/
> Me at Debian: http://wiki.debian.org/SandroTosi
> _______________________________________________
> Python mailing list
> [email protected]
> http://lists.python.it/mailman/listinfo/python
>
_______________________________________________
Python mailing list
[email protected]
http://lists.python.it/mailman/listinfo/python

Rispondere a