我正在学习python,并通过一个实际示例遇到了一个我似乎无法找到解决方案的问题。我使用以下代码得到的错误是
'list' object has to attribute 'upper'.
def to_upper(oldList):
newList = []
newList.append(oldList.upper())
words = ['stone', 'cloud', 'dream', 'sky']
words2 = (to_upper(words))
print (words2)
Run Code Online (Sandbox Code Playgroud)