
Python
NerdSully
334596595qq.com欢迎交流
展开
-
raw_input() 与 input() __ Python
这两个均是 python 的内建函数,通过读取控制台的输入与用户实现交互。但他们的功能不尽相同。举两个小例子。>>> raw_input_A = raw_input("raw_input: ") raw_input: abc >>> input_A = input("Input: ") Input: abc Traceback (most recent call las转载 2013-03-24 14:39:54 · 1001 阅读 · 0 评论 -
for 循环中奇怪的else
对于条件语句 if- else 我们已经很熟悉了, 但是在Python中,for-else用于处理遍历失败。比如我们要实现这样一个功能:找出(81,99)中最大的完全平方数并输出,找不到则输出提示。如果用c++的for循环实现,必须手动的判断for循环是否遍历失败:#include #includeusing namespace std;int main(){ int i原创 2013-03-24 16:09:30 · 13746 阅读 · 2 评论