Message390785
Hello Python Community!
One feature I think would be helpful would be a method to see if a str can be safely converted into a float. Currently, this is not doable without a long regex or a try-except block, as numbers like "-3.52" contain non-numeric symbols.
My suggestion is to make a new boolean method on the str class. Code-wise, it would behave quite similarly to this code:
def isfloat(s:str) -> bool:
try:
float(s)
return True
except:
return False
I appreciate your feedback, so what do you all think? |
|
Date |
User |
Action |
Args |
2021-04-11 14:53:35 | JimmyCarlos | set | recipients:
+ JimmyCarlos |
2021-04-11 14:53:35 | JimmyCarlos | set | messageid: <1618152815.46.0.189413617211.issue43808@roundup.psfhosted.org> |
2021-04-11 14:53:35 | JimmyCarlos | link | issue43808 messages |
2021-04-11 14:53:35 | JimmyCarlos | create | |
|