LabEx
Python 速查表 PDF

简介

  • 入门指南

速查表

  • 基础
  • 内置函数
  • 控制流
  • 函数
  • 列表和元组
  • 字典
  • 集合
  • 推导式
  • 字符串操作
  • 字符串格式化
  • 正则表达式
  • 文件和目录路径
  • 读写文件
  • JSON 和 YAML
  • 异常处理
  • 调试
  • Args 和 kwargs
  • 装饰器
  • 上下文管理器
  • 面向对象编程
  • 数据类
  • Packaging
  • 主程序:顶层脚本
  • 虚拟环境

标准库

  • Copy
  • CSV
  • Datetime
  • Itertools
  • JSON
  • OS
  • Pathlib
  • Random
  • Shelve
  • Subprocess
  • Zipfile

内置函数

  • abs
  • aiter
  • all
  • any
  • ascii
  • bin
  • bool
  • breakpoint
  • bytearray
  • bytes
  • callable
  • chr
  • classmethod
  • compile
  • complex
  • delattr
  • dict
  • dir
  • divmod
  • enumerate
  • eval
  • exec
  • filter
  • float
  • format
  • frozenset
  • getattr
  • globals
  • hasattr
  • hash
  • help
  • hex
  • id
  • import
  • input
  • int
  • isinstance
  • issubclass
  • iter
  • len
  • list
  • locals
  • map
  • max
  • memoryview
  • min
  • next
  • object
  • oct
  • open
  • ord
  • pow
  • print
  • property
  • range
  • repr
  • reversed
  • round
  • set
  • setattr
  • slice
  • sorted
  • staticmethod
  • str
  • sum
  • super
  • tuple
  • type
  • vars
  • zip

Python float() 内置函数

来自 Python 3 文档

从数字或字符串 x 构建一个浮点数。

简介

Python 中的 float() 函数是一个内置函数,它允许您将数字或包含数字的字符串转换为浮点数。当您需要执行需要小数精度的算术运算时,这特别有用。

float() 函数从数字或字符串返回一个浮点数。

示例

float('10')
float(10)
10.0
10.0

相关链接

  • int()
  • complex()
  • Python 数据类型
  • str()
  • round()
  • 字符串格式化
下一页Changelog
Python 速查表仓库博客
更多速查表

On this page