"If you are familiar with other computer languages, you may be used to terminating every line with a semicolon. There is no need to do so in Python. A line is a line, more or less. You may add a semicolon if you like, but it won’t have any effect (unless more code follows on the same line), and it is"
">>> 1 // 2 0"
"Back to the __future__ It has been rumored that Guido van Rossum (Python’s creator) has a time machine, because quite often when people request features in the language, the features have already been implemented. Of course, we aren’t all allowed into this time machine, but Guido has been kind enoug"
"str simply converts a value into a string in some reasonable fashion that will probably be understood by a user, for example.11 repr creates a string that is a representation of the value as a legal Python expression."
"A synonym for repr(x) is `x` (here, you use backticks, not single quotes). This can be useful when you want to print out a sentence containing a number: >>> temp = 42 >>> print "The temperature is " + temp Traceback (most recent call last): File "<pyshell#61>", line 1, in ? print "The temperature is"
作者简介
Magnus Lie Hetland是挪威科技大学副教授,教授算法。喜欢钻研新的编程语言,是Python语言的坚定支持者。他写过很多Python方面的书和在线教程,比如深受大家欢迎的网上教程Instant Python。