3.2.Basic knowledges
1.Lines and Indented Block是使用{}來作為function或class區塊的畫分, 而是使用line indentation
在同一個block的code, line indentation的數量必須相同
error condition
if True: print "Answer" print "True" else: print "Answer" print "False"
2.Multi-Line Statements
Python中使用\作為連接換行
total = item_one + \ item_two + \ item_three
3.Comments (註解)
Python使用hash(#)
# First comment print "Hello, Python!" # second comment
4.Waiting for the User
raw_input
print "Enter a file name:" filename = raw_input()
Last updated
Was this helpful?