[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] OT - getting file name from path string



On 6/29/06, altern <altern2@xxxxxxxxx> wrote:
i need to get the name of a file from the string containing the path.

import os.path
p = r'c:\file\myfile.gif'
os.path.basename(p)
'myfile.gif'
os.path.dirname(p)
'c:\\file'


Hope that helps.

--
Rikard.