Expand|Select|Wrap|Line Numbers
- for dirpath,dirs,files in os.walk(cwd):
- for file in files:
- global z_path
- z_path = os.path. # WHAT WOULD GO HERE # (dirpath)
- print z_path
C:\Documents and Settings\B\Desktop\Test\T1\test.txt.
What I want is to go from cwd (in this case Test) and just print to screen
\T1\test.txt
I have tried many os.path pathname manipulators like...
abspath( path)
basename( path)
commonprefix( list)
dirname( path)
split( path)
splitdrive( path)
splitunc( path)
...and none seem to work.
I can't think of any way to do this with a url that will change so the url could also be...
C:\Documents and Settings\B\Desktop\Test\T1\444\test.txt.
and I want it to go from test > test.txt or T1\444\test.txt...
Ignore whats below if it doesn't make sense.
I thought of assigning a variable to cwd and then splitting the url based on that, but I don't know how to go about doing that specifically.
Does anyone know how this could be done?