我需要显示多个单词的第一个字母,这些单词是从列表中的多个项目中收集的
尝试收集列表项,使用word.split(" ")
和song[0][0/1]
将它们分开
for word in song:
songWords = word.split(" ")
songLetter1 = songWords[0][0]
songLetter2 = songWords[1][0]
print("")
print("The artist is", artist, "and the first letter of the song is",
songWord1, songWord2)
希望是“s”和一个数字,取决于随机选择的项目
如果输入是列表
从.txt文件中读取文本后,可以将其存储在字符串中。我假设字符串看起来像下面的宋体。你知道吗
尝试:
希望这有帮助!你知道吗
相关问题 更多 >
编程相关推荐