Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python input float

Assuming you mean that you are trying to conver the input to float,
you can do

myfloat = float(input("Enter a float: "))

However, do remember that this will return an expection if non-numbers and decimal points
are detected.
Here is a better version

import re
myfloat = float(re.sub("[^0-9.]","",input("Enter a float: ")))

It auto removes any nonnumeric and non decimal point characters.
Comment

python input float

pi = input("What's the value of pi? ")
pi = float(pi)
Comment

PREVIOUS NEXT
Code Example
Python :: what is a slug 
Python :: numpy delete 
Python :: print each item in list python single statemnt 
Python :: python check phone number 
Python :: python random walk 
Python :: pandas df sample 
Python :: python int to bytes 
Python :: termcolor print python 
Python :: make sns heatmap colorbar larger 
Python :: stop procedure python 
Python :: all select first value in column list pandas 
Python :: numpy get diagonal matrix from matrix 
Python :: how to make button in python 
Python :: xpath start-with 
Python :: python randrange 
Python :: extract DATE from pandas 
Python :: for loop from n to 1 in python 
Python :: how to find permutation of numbers in python 
Python :: flask authentication user without database 
Python :: how to get number after decimal point 
Python :: get weekday from date python 
Python :: add readme cmd 
Python :: concatenate list of strings python 
Python :: crawl a folder python 
Python :: python raise exception 
Python :: django message 
Python :: append two list of number to one python 
Python :: envScriptsactivate.ps1 : File 
Python :: aws django migrate 
Python :: sorting values in dictionary in python 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =