1
# coding: utf-8

如果想让代码中可以输入中文,必须要加上这一句。

1
2
3
def add_function(a, b):
c = a + b
print c

Python 中定义一个函数用 def 关键字,函数没有大括号,用tab空格代表方法体。

1
2
3
4
5
num = 100
tempC = "Number: "
print tempC + `num`
print tempC + str(num)
print tempC + repr(num)
阅读全文 »