当前位置:网站首页>Variable and immutable data types
Variable and immutable data types
2022-07-24 18:15:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Python Medium data type
With Python3 For example ,Python3 There are several standard data types in
Number( Numbers )
Bool ( Boolean value )
String( character string )
List( list )
Tuple( Tuples )
Sets( aggregate )
Dictionary( Dictionaries )The basis for dividing variable and immutable types
Variable data type
Variable data type :value Value change ,id The value remains the same Immutable data types
Immutable data types :value Value change ,id The value also changes How to determine whether the data type is variable or immutable
According to the concept of variable data type and immutable data type , Just change value When it's worth it , Use id() Function to view variables id Whether the value changes can tell whether this data type is variable or immutable
num = 10
print(id(num)) #1388664736
num2 = 20
print(id(num2)) #1388664736From the above example, we can draw a conclusion :num Is numeric type , Numeric types are immutable data types ; Other data types use id() Function can draw a conclusion .
Variable data types contain content
Dictionary( Dictionaries )List( list )Immutable data types contain content
Number( Numbers )String( character string )Tuple( Tuples )
Bool( Boolean value )Divided by access type
Direct access : Numbers
Sequential access : character string list Tuples
Map access : Dictionaries Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/124473.html Link to the original text :https://javaforall.cn
边栏推荐
- 0627~ holiday knowledge summary
- Polymorphism, abstract class, interface
- 13 essential methods of color!
- 0701~ holiday summary
- BOM understanding in odoo
- XSS绕过姿势总结
- [OBS] dependency Library: x264 vs Build
- 0630~ professional quality course
- 字符串常用方法(2)
- The ability to detect movement in vivo and build a safe and reliable payment level "face brushing" experience
猜你喜欢

Go language interface and type

Emerging potential of interactive virtual reality technology in drug discovery

继承与派生

SSM framework learning

JMeter -- silent operation

Bib | mol2context vec: context aware deep network model learning molecular representation for drug discovery

jmeter --静默运行

Common methods of number and math classes
去不图床容量兑换

T245982 "kdoi-01" drunken flower Yin
随机推荐
如何遵循“低耦合”设计原则?
去不图床容量兑换
Array object methods commonly used traversal methods & higher-order functions
Three ways of redis cluster
下拉列表组件使用 iScroll.js 实现滚动效果遇到的坑
0615 ~ realize RBAC permission management with user-defined annotations
JS数组方法 sort() 排序规则解析
XSS绕过姿势总结
0613 ~ self study
Section 11 cache avalanche, hot data failure follow Daewoo redis ------- directory post
0612~quartz timer frame
0615~用自定义注解实现RBAC权限管理
Win10 super good-looking mouse theme, you also try it
What are the pitfalls from single architecture to distributed architecture?
数组扁平化.flat(Infinity)
New can also create objects. Why do you need factory mode?
The ability to detect movement in vivo and build a safe and reliable payment level "face brushing" experience
0611~ self study class
第五届数字中国建设峰会在福建福州开幕
6126. Design food scoring system