[Tutor] String within a string solution (newbie question)

Alan Gauld alan.gauld at yahoo.co.uk
Wed Oct 26 14:34:58 EDT 2016


On 26/10/16 19:06, Wish Dokta wrote:

> folders with a drive/directory. To do this I am storing each directory in a
> dict as the key, with the value being the sum of the size of all files in
> that directories (but not directories).
> 
> For example:
> 
> for "C:\\docs\\code" in key:
> 
> Which works fine and will return "C:\\docs\\code" : 20,
> "C:\\docs\\code\\snippets" : 5, "C:\\docs\\code\\python" : 10 = (35)
> 
> However it fails when I try to calculate the size of a directory such as
> "C:\\docs", as it also returns "C:\\docs123".
> 
> I'd be very grateful if anyone could offer any advice on how to correct
> this.

We can't guess what your code looks like, you need to show us.
Post the code and we can maybe help.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list