Hye. How can I change a string into a variable that I have defined before.
This is my code:
A = 'A.mpeg'
B = 'B.mpeg'
C = 'C.mpeg'
D = 'D.mpeg'
E = 'E.mpeg'
F = 'F.mpeg'
G = 'G.mpeg'
k = 'AAABBCCDD'
k = list(k)
print(k)
for i in range(len(k)):
print(i, k[i])
pygame.mixer.music.load(k[i])
pygame.mixer.music.play()
time.sleep(0.7)
The error I get is pygame.error: Couldn't open 'A'
. I assume I need to convert k[0] = 'A' to just A as the variable A i've defined before.
Thank you.