Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Sep 2005
    Messaggi
    670

    PYTHON come importare un file?

    Ciao a tutti,
    Ho la seguente struttura

    C:\lavoro\python\test

    C:\lavoro\python\test\lib

    C:\lavoro\python\test\lib\Email.py

    C:\lavoro\python\test\programma

    C:\lavoro\python\test\pogramma\programma.py

    praticamente da programma.py devo importare il file Email.py

    Come devo fare? Inoltre, serve un fle __init__.py ? (se si in quale directory andrebbe messo?)

    Grazie mille!!!!

  2. #2
    Email.py deve stare all'interno di un "pacchetto" e avere un setup.py che lo installi in C:\pythonXX\Lib\site-packages\tuo-pacchetto\Email.py
    Rilasciata Python FTP Server library 0.5.1
    http://code.google.com/p/pyftpdlib/

    We'll be those who'll make the italian folks know how difficult can be defecating in Southern California without having the crap flying all around the house.

  3. #3
    Utente di HTML.it
    Registrato dal
    Aug 2010
    Messaggi
    10
    Devi aggiungere al path il percorso dove andare a cercare le librerie.

    import sys
    sys.path.append('C:\\lavoro\\python\\test\\lib\\')

    ciao

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.