hi guys!
Im struggling for play a sound with this command.
I need XXX become the current_sound value.
Can you help me? how you can see im very noob on python
current_sound = item_list[current_item_index]["som"] playsound("C:/Users/thoma/Desktop/test/XXX.mp3")
thanks!
You should look into the
format method of strings, or the even newer
f-string syntax (Python 3.6+).
# format method
current_sound = playsound("C:/Users/thoma/Desktop/test/{}.mp3".format(item_list[current_item_index]["som"]))
# f-string
current_sound = playsound(f"C:/Users/thoma/Desktop/test/{item_list[current_item_index]['som']}.mp3")
(Jan-05-2020, 12:53 AM)ichabod801 Wrote: [ -> ]You should look into the format method of strings, or the even newer f-string syntax (Python 3.6+).
# format method
current_sound = playsound("C:/Users/thoma/Desktop/test/{}.mp3".format(item_list[current_item_index]["som"]))
# f-string
current_sound = playsound(f"C:/Users/thoma/Desktop/test/{item_list[current_item_index]['som']}.mp3")
Thank your for the answer!
i've got an error: TypeError: 'module' object is not callable
You are going to need to show more code and the full text of the error. Please use python and output tags when posting code and results.
Here are instructions.