[英]Reading individual strings in an array
I have a program that searches for Spotify songs.我有一个搜索 Spotify 歌曲的程序。 I want it to go through an array with a list of songs and search for them individually:
我希望它通过带有歌曲列表的数组 go 并单独搜索它们:
songs = ['song1', 'song2', 'song3']
spotifyObject.search(songs)
spotifyObject.search
followed by whatever is in the brackets is how you search for songs, I want to have a loop what searches 'song1'
, then 'song2'
etc. - so essentially replacing the variable in the brackets each time. spotifyObject.search
后跟括号中的内容是您搜索歌曲的方式,我想要一个循环搜索'song1'
'song2'
等 - 所以基本上每次都替换括号中的变量。
Sound like you just want to loop though the list...听起来你只想循环遍历列表......
for item in songs:
spotifyObject.search(item)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.