move up a level

Gabriel Genellina gagsl-py at yahoo.com.ar
Tue Nov 21 01:55:34 EST 2006


At Tuesday 21/11/2006 03:07, rplobue at yahoo.com wrote:

>alright, noob question: i want to open a file in a directory above the
>current one i'm in.  I'm trying to use myfile =
>open('../thefileiwant.txt', 'r')  but the ../ doesn't work.  How do i
>do it?

Above the process' current dir, or above the dir where the script resides?
You get the latter with os.path.abspath(__file__)


-- 
Gabriel Genellina
Softlab SRL 

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar



More information about the Python-list mailing list