In <[EMAIL PROTECTED]>, Amit Khemka wrote: > On 4/5/07, Amit Khemka <[EMAIL PROTECTED]> wrote: >> On 5 Apr 2007 04:58:22 -0700, Sergei Minayev <[EMAIL PROTECTED]> wrote: > <snip> >> An Example: >> >> import os >> root='/my/root/directory' >> id =0 >> tree={root:(-1, id)} >> id+=1 >> for path, dirs, files in os.walk(root): >> for dir in dirs: >> if not tree.has_key(path+'/'+dir): >> tree[path+'/'+dir]=(tree[path][1], id) >> id+=1 >> >> […] > > use os.sep instead of '/' !
Or even better `os.path.join()` instead of building the strings with ``+``. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list