码迷,mamicode.com
首页 > 其他好文 > 详细

内置函数

时间:2018-08-09 17:41:59      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:module   字符   cme   bubuko   oca   pen   put   def   txt   

技术分享图片


# 掌握
# res=‘你好‘.encode(‘utf-8‘)
# print(res)
#
# res=bytes(‘你好‘,encoding=‘utf-8‘)
# print(res)

# 参考ASCII表将数字转成对应的字符
# print(chr(65))
# print(chr(90))
# 参考ASCII表将字符转成对应的数字
# print(ord(‘A‘))

# print(divmod(10,3))


# l=[‘a‘,‘b‘,‘c‘]
# for item in enumerate(l):
# print(item)

# l=‘[1,2,3]‘
# l1=eval(l)
# print(l1,type(l1))
# print(l1[0])

# with open(‘a.txt‘,encoding=‘utf-8‘) as f:
# data=f.read()
# print(data,type(data))
# dic=eval(data)
# print(dic[‘sex‘])

# print(pow(3,2,2)) # (3 ** 2) % 2

# print(round(3.3))

# print(sum(range(101)))


# module=input(‘请输入你要导入的模块名>>: ‘).strip() #module=‘asdfsadf‘
# m=__import__(module)
# print(m.time())















# 面向对象里的重点
classmethod
staticmethod
property

delattr
hasattr
getattr
setattr

isinstance
issubclass

object

super


# 了解
# print(abs(-13))
# print(all([1,2,3,]))
# print(all([]))

# print(any([0,None,‘‘,1]))
# print(any([0,None,‘‘,0]))
# print(any([]))

# print(bin(3)) #11
# print(oct(9)) #11
# print(hex(17)) #11

# print(callable(len))

# import time
# print(dir(time)) #列举出所有:time.名字


# s=frozenset({1,2,3}) # 不可变集合
# s1=set({1,2,3}) # 可变集合

# a=1111111111111111111111111111111111111111111111
# # print(globals())
# # print(locals())
# def func():
# x=222222222
# # print(globals())
# print(locals())
# func()

# hash([1,2,3])

# def func():
# """
# 文档注释
# :return:
# """
# pass
#
# print(help(func))

# l=[‘a‘,‘b‘,‘c‘,‘d‘,‘e‘]
# s=slice(1,4,2)
# print(l[1:4:2])
# print(l[s])

# print(vars())

内置函数

标签:module   字符   cme   bubuko   oca   pen   put   def   txt   

原文地址:https://www.cnblogs.com/zhouxiang9193/p/9449371.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!