zhyDaDa的个人站点

目录


type

type(x)返回x的类型
一共有 五大序列

整数

>>> x=1
>>> type(x)
<class 'int'>

浮点数

>>> x=.5
>>> type(x)
<class 'float'>

数组

>>> x=[1,2,3]
>>> type(x)
<class 'list'>

字符串

>>> x='''Tom said,\n "Let's go!"'''
>>> x
'Tom said,\n "Let\'s go!"'
>>> print(x)
Tom said,
 "Let's go!"
>>> type(x)
<class 'str'>

复数

>>> 1j*1j
(-1+0j)

取地址

id(x)返回一个代表地址的整数

注意, 修改变量的值地址也会改变

函数

ord(x)获得ASCII码
dir(import)列出库中对象
help(fun)获得函数的说明

Avatar photo
我是 zhyDaDa

前端/UI/交互/独立游戏/JPOP/电吉他/游戏配乐/网球/纸牌魔术

发表回复