How to extract a floating number from a string [duplicate]

If your float is always expressed in decimal notation something like >>> import re >>> re.findall(“\d+\.\d+”, “Current Level: 13.4db.”) [‘13.4’] may suffice. A more robust version would be: >>> re.findall(r”[-+]?(?:\d*\.\d+|\d+)”, “Current Level: -13.2db or 14.2 or 3”) [‘-13.2’, ‘14.2’, ‘3’] If you want to validate user input, you could alternatively also check for a float … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)