Reputation: 21
This is my code I want to import all the wav file stored in my desktop. But every time it showing some error if I'm changing the backslash. EOL error is showing.
no_of_recordings=[]
for label in labels:
waves = [f for f in os.listdir('Desktop/yes' + '/'+ labels) if f.endswith('.wav')]
no_of_recordings.append(len(waves))
Error message:
TypeError: can only concatenate str (not "list") to str
Upvotes: 0
Views: 237
Reputation: 1183
Just a typo, use the iterating current object instead of the list:
os.listdir('Desktop/yes' + '/'+ label)
Upvotes: 2