python括号是中文还是英文_Python括号约定
我認為幾乎沒有標準。在
我見過兩種縮進方式:Indent 1:
my_dictionary = {
'uno': 'something',
'number two': 'some other thing',
}
Indent 2:
my_dictionary = {'uno': 'something',
'number two': 'some other thing',
}
我已經看到了三個括號:
^{pr2}$
有時你會證明這些價值觀:my_dictionary = {'uno': 'something',
'number two': 'some other thing',
}
有時甚至連科隆:my_dictionary = {'uno' : 'something',
'number two' : 'some other thing',
}
看起來很奇怪。在
有時你有一個逗號,有時沒有:my_dictionary = {'uno': 'something',
'number two': 'some other thing'}
有時你會把它們都放在一排(如果合適的話)。在my_dictionary = {'uno': 'something', 2: 'some other thing'}
似乎每個人都有自己的風格組合。就我個人而言,我傾向于你在例子中使用的風格,除非有理由不這么做。不這樣做的常見原因是當你把詞典作為陳述的一部分時。是這樣的:amethodthattakesadict({'hey': 'this',
'looks': 'a',
'bit': 'shitty',
})
我建議你適應編寫你正在編輯的代碼的人的風格。如果這是你的準則:隨心所欲。:-)
總結
以上是生活随笔為你收集整理的python括号是中文还是英文_Python括号约定的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 华为u8860手机 android4.0
- 下一篇: 手动控制DELL服务器风扇转速