Python: How to do this string manipulation
<p>Folks,
Might find this on searching, but need this rather quickly done:</p>

<p>I have the path like this: /mnt/path1/path2/path3/</p>

<p>I need to chown all the directories such as /mnt, /mnt/path1, /mnt/path1/path2, /mnt/path1/path2/path3, how to get this done in python?</p>

<p>I cannot do 'chown -R /mnt/' since it tries to chown all the files/directories that exist beneath path3, but I wish to chown only upto path3 here for example.</p>

<p>Thank you for any suggestions!</p>
