python 数据类型

Python有以下六种类型

1.数字(int)

int  (整形)

2.字符串(str)

str  字符串

3.列表(list)

list 

4.字典(dict)

5.布尔值(bool)

以上所有的类型都有很多的魔法方法

如列表list 的方法右list.append() 往列表添加数据

str.upper()   将字符串变为大写

每一个类型都是封装为一个类class int(obj)、class str(obj)、class dict(obj)、class list(obj)、class bool(obj)

在pycharm中输入对应的类型名称,按住ctrl 然后点击名称即可进入对应的类,查看所有的魔法方法。

可以进行调用

原文地址:https://www.cnblogs.com/ch2020/p/12323817.html