热线电话:13121318867

登录
2019-02-12 阅读量: 995
python中空格有什么作用

最常见的空格字符如下:

Python解释器大多忽略了空格,而且大部分都不需要空格。当清楚一个命令行结束并且下一个命令行开始时,可​​以省略空格。当涉及特殊的非字母数字字符时通常会出现这种情况。

例子:

# Example 1

# This is correct but whitespace can improve readability

a = 1-2 # Better way is a = 1 - 2

print(a)

# Example 2

# This is correct

# Whitespace here can improve readability.

x = 10

flag =(x == 10)and(x<12)

print(flag)

""" Readable form could be as follows

x = 10

flag = (x == 10) and (x < 12)

print(flag)

"""

# Try the more readable code yourself

0.0000
4
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子