Skip to content

Instantly share code, notes, and snippets.

@jumasheff
Created March 4, 2020 10:40
Show Gist options
  • Select an option

  • Save jumasheff/6c3e377a6024b24b147f70dbc53b389a to your computer and use it in GitHub Desktop.

Select an option

Save jumasheff/6c3e377a6024b24b147f70dbc53b389a to your computer and use it in GitHub Desktop.
Finds particular string at returns it
import re
l = ['123 м2', '123.43 м2 ывсвсв', None, '']
def t(x):
if x is None:
return ''
m = re.findall('^[-+]?[0-9]*[.,]?[0-9]+\s*м2', x)
if len(m) > 0:
return m[0]
return ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment