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)


暂无数据
推荐帖子
0条评论
0条评论
0条评论