[Tutor] annoying directory structure

Jim Mooney cybervigilante at gmail.com
Fri Apr 10 00:17:51 CEST 2015


Looks like I can work it, but some walk paths are coming out as two strings
back to back, which I know python concatenates with print, but how do I
concatenate them without print so I can use them in my script to append to
the mp4 filenames and have a windows readable path?. i.e., I am getting
this sort of triplet when I go through the generator. After doing that the
rest seems easy enough:

A = ('I:\\VIDS\\Learn Python Track\\07. Regular Expressions in
Python\\Stage '
 '1\\01. Introduction to Regular Expressions\\07. Compiling and Loops',
 [],
 ['Compiling and Loops.mp4', 'Compiling and Loops.srt'])

>> A[0]

('I:\\VIDS\\Learn Python Track\\07. Regular Expressions in Python\\Stage '
 '1\\01. Introduction to Regular Expressions\\07. Compiling and Loops')

Still two unconcatenated strings

And why do I still have tuple parentheses for A[0], which should be a
concatenated string?


> > Another question. I have a set of training vids. Unfortunately, each vid
> is
> > in a subdir inside a subdir inside a subdir inside a subdir inside the
> > directory. Going down, down, down, up, up, up to nab them (they're short)
> > and remember where I am, is annoying. How do I use python to get a simple
> > straight list of the vids in directory order - full windows path - so I
> can
> > just copy and plug the paths into windows explorer, one at a time?
>
> Have a look at os.walk(), it will enable you to walk (hence the name)
> through all directories in a tree.  Take a crack at it, and if you
> have trouble come back with some code for us to look at.  You may also
> need os.path.abspath to get the full path.
>
> --
> Zach
>



-- 
Jim

"Stop, Harold! That bagel has radishes!"
"Thank God, Mary - you've saved me again!"


More information about the Tutor mailing list