python-cheatsheet
BlogTimeless Python
python cheatsheet repository

Introduction

  • Getting started
  • Contributing

Cheatsheet

  • Basics
  • Built-in functions
  • Control flow
  • Functions
  • List and Tuples
  • Dictionaries
  • Sets
  • Comprehensions
  • Manipulating strings
  • String formatting
  • Regular expressions
  • Files and directory paths
  • Reading and writing files
  • Json and Yaml
  • Exception handling
  • Debugging
  • Args and Kwargs
  • Context manager
  • Main: top level script
  • setup.py
  • Dataclasses
  • Virtual environments

Standard Library

  • Datetime
  • Itertools
  • Json
  • Random
  • Os
  • Pathlib

Python float() built-in function

From the Python 3 documentation

Return a floating point number constructed from a number or string x.

Examples

>>> float('10')
# 10.0
>>> float(10)
# 10.0
Edit this page on GitHub
Do you have a question? ask the community
Do you see a bug? open an issue on GitHub
Deploys by Netlify

On this page