类名约定python

代码示例

9
0

python命名约定

#module names should be all lowercase
import mymodule
#normal variables are lowercase_with_underscores
my_variable = 'value'
#constants are UPPERCASE
CONSTANT = 'never changes'
#classes are UpperCaseCamelCase
class MyClass(self):
    pass
2
0

pep8

# pep8 Style Guide for Lists
my_list = [
    1, 2, 3,
    4, 5, 6,
    ]
result = some_function_that_takes_arguments(
    'a', 'b', 'c',
    'd', 'e', 'f',
    )
0
0

类名约定python

# PEP 8 Class names
# Class names should normally use the CapWords convention.

class MyClass:
  def __init__(self):
    # Variable and method names are snake_case
    self.load_time = 25
  def print_value(self, value):
    print(value)

类似页面

带有示例的类似页面

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................