Reputation: 27
I want to create an iterator to run and print all the parts with the numbers, how do I access them? I marked in black what I needed the narrator to run and print
Upvotes: 1
Views: 55
Reputation: 4537
You can use two splits, one at -
and one at ,
notes = 'sol,250-mi,250-mi,500-fa,250-re,250-re,500-do,250-re,250-mi,250-fa,250'
numbers = [temp.split(',')[1] for temp in notes.split('-')]
Upvotes: 1
Reputation: 9647
You're pretty much there already. After your first split
command, duration
is a list of strings.
Then you iterate over those strings and on each of those you call split
again, but with ,
instead of -
.
Upvotes: 0