Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use python basic variables

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report