In [ ]:
from collections import Counter
import re
regex=re.compile(".*<units>(.*?)</units>")
unitlist = []
with open('units.txt') as f:
while True:
line = f.readline()
if line == '':
break
x = re.match(regex, line)
unitlist.append(x.group(1).strip())
c = Counter(unitlist)
ulist = c.most_common()
In [ ]:
val = "/apps/youngsmoduluse/current/rappture/tool.xml: <units>N</units>"
x = re.match(regex, val)
print(x, type(x))
In [ ]:
these_regex=".*<units>(.+?)</units>"
pattern=re.compile(these_regex)
x = re.match(pattern, val)
x.group(0)
In [ ]:
for name, count in ulist:
print(name)
In [ ]:
len(ulist)
In [ ]:
from sympy import latex, sympify
latex(sympify('cm**2'))
In [ ]:
import ipywidgets as widgets
x = widgets.FloatText(value=42)
x
In [ ]:
def mycb(w):
print("MYCB", w)
def mycb2(w):
print("MYCB2", w)
In [ ]:
x.observe(mycb, names='value')
In [ ]:
x.observe(mycb2, names='value')
In [ ]:
x.unobserve_all()
In [ ]:
widgets.Checkbox?