Python中的列表语法错误

2024-09-30 06:22:44 发布

您现在位置:Python中文网/ 问答频道 /正文

python版本:2.71

每当我试图用IDLE运行它时都会遇到语法错误。。。。在

horsemen = ["war", "famine", "pestilence", "death"]
i = 0
while i < 4:
    print horsemen[i]
    i = i + 1 

错误发生在骑手和等号之间


Tags: 版本错误printidle语法错误whilewardeath
2条回答

代码很好(语法上)。您的python环境一定有问题。还要确保它是正确的缩进。在

有什么原因不能使用for循环吗?在

for god in horsemen:
    print god

相关问题 更多 >

    热门问题