python bif(内置函数)

1 ord

如何获取ascii码,使用内置函数ord()

1
2
3
4
ord("A")
65
ord("a")
97

804. 唯一摩尔斯密码词

2 sorted

https://www.runoob.com/python3/python3-func-sorted.html

1
2
3
4
sorted([-3,4,2],key=abs)
Out[5]: [2, -3, 4]
sorted([-3,4,2])
Out[6]: [-3, 2, 4]

3 iter 和 next函数

4 dir

https://www.runoob.com/python/python-func-dir.html

5 filter

只保留true,过滤false

filter(lambda x:x%2==0,[1,2,3,4,5]) [2,4]

Author

Lavine Hu

Posted on

2022-04-10

Updated on

2024-04-13

Licensed under

# Related Post
  1.logging
  2.python内存管理
  3.路径
  4.pandas
  5.
  6.metaclass
  7.unittest
  8.list
Comments

:D 一言句子获取中...