Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use python basic variables

Shulou Source: shulou.com Published: 2022-06-02 21:09:30 10月01日 Update

This article introduces the knowledge of "how to use python basic variables". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

I. variables

1.1

Naming conventions for variables

You can only use numeric underscores, but you cannot start with a number and you cannot use keywords.

1.2

Nomenclature of small hump

Except for the first word, the first letters of other words are capitalized.

HelloWorldMy = 1

1.3

Great hump nomenclature

In the big hump method, the first word is capitalized, and so is the first letter of the following word.

HelloWorldMy = 1

1.4

Descending line nomenclature

My_functions = function

1.4

View all python keywords

Import keyword

L = keyword.kwlist

Print (l)

# ['False',' None', 'True',' and', 'as',' assert', 'async',' await', 'break',' class', 'continue',' def', 'del',' elif', 'else',' except', 'finally',' for', 'from',' global', 'if',' import', 'in',' is', 'lambda' 'nonlocal', 'not',' or', 'pass',' raise', 'return',' try', 'while',' with', 'yield']

1.5

Definition of variables

Name = 'perhaps'

Print (name)

# perhaps

1.6

Other ways

X = y = z = 1

Print (xmeme yjinz)

XBM y rec z = 1 pm 2 pm 3

Print (xmeme yjinz)

A _ 3.

Print (a) http://www.120zhongyuanyy.com/ of Zhengzhou STD Hospital

Print (b)

Print (c)

A _ c = [1,2,3]

Print (a)

Print (b)

Print (c)

''

1 1 1

1 2 3

[1, 2, 3]

Process finished with exit code 0

This is the end of "how to use python basic variables". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Variables words capitals letters humps foundations keys keywords content numbers more knowledge practicality achievement next underlining hospital dilemma reality beginning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Redmi MySQL MariaDB Xiaomi