如何解决python中的文件“ ”错误? [关闭]

问题描述 投票:0回答:1

我收到此错误:

File "<stdin>", line 2
    print("hello " + friend)
        ^
IndentationError: expected an indented block

关于python中的简单代码。我尝试检查语法,但没有发现任何错误。这是代码:

friends = ["a", "b", "c", "d"]
for friend in range(friends):
print("hello "+friend)
python stdin
1个回答
0
投票

使用此

friends = ["a", "b", "c", "d"]
for friend in friends:
    print("hello "+friend)

给您以下信息

你好你好乙你好ç你好d

output

© www.soinside.com 2019 - 2024. All rights reserved.