调用此函数时出现错误SyntaxError: keyword can't be an expression
def printAlbum(**albums):
for year in albums:
print year, albums[year]
printAlbum(2002='by the way', 1999='californication', 2006 = 'stadium arcadium')
使用字母键调用该函数没有问题。我尝试在键周围加上引号并将其替换为=
,:
但这并没有解决问题。我可以将数字键传递给函数吗?