txt中的内容是一篇英语文章,要读取并判断文章中每一个单词的首字母是否为元音字母并转换形式。c = b + Initial + "py"这一句会报错 TypeError: must be str, not list
Python 小白求指点。
file = open(r'C:\football.txt','r')
lines = file.readlines()
for word in lines:
List = word.split()
Initial = List[0:1]
if Initial != 'a' or 'e' or 'i' or 'o' or 'u':
b = word[1:len(word)]
c = b + Initial + "py"
print(c.lower())