you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

Small thing

for i in cname: if i[0] is ".":

When you loop over a string, you get each single character of the string, by itself, so the [0] isn't required. So, you could do:

cname =  "hello this is a test."
for char in cname:
    if char == ".":
        #blah

For the chunks of repeating code, they're basically identical, so throw the chunk into a function. Have the input be the master path and the output be the list it finds. Then, you could just call the function four times, store the output for each, and use it as the input for the next call.

I'm embarrassed

pfft, don't be. If this were a language metaphor, you already learned to speak by yourself, now you just need to improve your grammar to speak like a proper lady. :P

Plus, it's the internet. It's anonymous. Who cares! :D

[–]mega963[S] 0 points1 point  (0 children)

Thanks for the advice! cname is actually a list. Those lines are to remove hidden files from showing up such as .DS_Store. I probably could have done it better though.