网站首页 > 基础教程 正文
本文示例了python库的所有属性方法以及帮助信息,并介绍了ascII码字符和字符编号
代码如下:
import math
print(dir(math)) #打印math库的所有属性方法
print(help(math.modf)) #打印math库的modf有属性方法
print(math.modf(10))
print(math.__doc__) #打印math的描述性说明
ch1="A"
print("ord(ch1)即A的字符编码:",ord(ch1)) #打印A的字符串的ASCII字符集编号,A的长度只能为1
ch2="a"
print("ord(ch2)即a的字符编码:",ord(ch2))
print("97的字符:",chr(97)) #打印97对应的ASCII字符
ch3="中"
print("ord(ch3):",ord(ch3)) #打印汉字中的ASCII字符集编号
代码运行结果如下:
['__doc__', '__loader__', '__name__', '__package__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'e', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'inf', 'isclose', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log10', 'log1p', 'log2', 'modf', 'nan', 'pi', 'pow', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'tau', 'trunc']
Help on built-in function modf in module math:
modf(x, /)
Return the fractional and integer parts of x.
Both results carry the sign of x and are floats.
None
(0.0, 10.0)
This module is always available. It provides access to the
mathematical functions defined by the C standard.
ord(ch1)即A的字符编码: 65
ord(ch2)即a的字符编码: 97
97的字符: a
ord(ch3): 20013
图片示例如下:
猜你喜欢
- 2024-11-15 使用Python读取Excel文件(python读取excel文件并画图)
- 2024-11-15 自动化测试学习:使用python库Paramiko实现远程服务器上传和下载
- 2024-11-15 PyPDF2是python的处理PDF文件的基本操作介绍
- 2024-11-15 RAG实战篇:精准判断用户查询意图,自动选择最佳处理方案
- 2024-11-15 03 Python数据类型转换(python数据类型转换函数)
- 2024-11-15 Pytest丨如何使用全功能的Python测试框架?小白必看
- 2024-11-15 Python自带单元测试框架UnitTest,如何生成独立的测试报告?
- 2024-11-15 新手常见的python报错及解决方案(新手常见的python报错及解决方案有哪些)
- 2024-11-15 使用Python 模块 轻松集成功能(python用什么集成开发环境)
- 2024-11-15 Python学习教程(二)(“python教程”)
- 06-18单例模式谁都会,破坏单例模式听说过吗?
- 06-18Objective-c单例模式的正确写法「藏」
- 06-18单例模式介绍(单例模式都有哪些)
- 06-18前端设计-单例模式在实战中的应用技巧
- 06-18PHP之单例模式(php单例模式连接数据库)
- 06-18设计模式:单例模式及C及C++实现示例
- 06-18python的单例模式(单例 python)
- 06-18你认为最简单的单例模式,东西还挺多
- 最近发表
- 标签列表
-
- jsp (69)
- gitpush (78)
- gitreset (66)
- python字典 (67)
- dockercp (63)
- gitclone命令 (63)
- dockersave (62)
- linux命令大全 (65)
- pythonif (86)
- location.href (69)
- dockerexec (65)
- tail-f (79)
- queryselectorall (63)
- location.search (79)
- bootstrap教程 (74)
- 单例 (62)
- linuxgzip (68)
- 字符串连接 (73)
- html标签 (69)
- c++初始化列表 (64)
- mysqlinnodbmyisam区别 (63)
- arraylistadd (66)
- mysqldatesub函数 (63)
- window10java环境变量设置 (66)
- c++虚函数和纯虚函数的区别 (66)