摘要:
在Python的很多源文件中,会有这样的语句: 比如有两个源文件A.py和B.py,都有上面的代码:在B.py中导入了A.py: import A 执行B.py,B.py中的 if __name__ == "__main__": 解释为 if B==B: 在执行到B.py中导入的A.py文件中的 i 阅读全文
摘要:
交换变量 x = 6 y = 5 x, y = y, x print x >>> 5 print y >>> 6 if 语句在行内 print "Hello" if True else "World" >>> Hello 连接 if 语句在行内 连接 下面的最后一种方式在绑定两个不同类型的对象时显得 阅读全文