![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
文章平均质量分 77
专注Python
一个想做程序员的包装工程师···
展开
-
Python中if __name__ == '__main__':作用
#hello.py def sayHello(): str="hello" print(str); if __name__ == "__main__": print ('This is main of module "hello.py"') sayHello() python作为一种脚本语言,我们用python写的各个module都可以包含以上那么一个累转载 2014-10-22 21:59:37 · 346 阅读 · 0 评论 -
Python核心编程 第二版 第二章 部分习题解答
2–5. 循 环和数字 分 别使用while 和for 创建一个循 环: (a) 写一个while 循 环, 输出整数从0 到10。(要确保是从0 到10, 而不是从0 到9 或从1 到10) i = 0 while i print i i +=1 (b) 做同 (a) 一 样的事, 不 过这 次使用 range() 内建函数。 for原创 2014-10-25 00:34:47 · 1455 阅读 · 1 评论