擅长:python、mysql、java
<p>使用<a href="https://docs.python.org/2/library/re.html#re.findall" rel="nofollow noreferrer">^{<cd1>}</a>:</p>
<pre><code>>>> out = []
>>> for s in l:
out.append( float(re.findall('\d+(?:\.\d+)?', s)[0]) )
>>> out
=> [7.2, 8.0]
</code></pre>
<p>或者,不使用<code>regex</code>,使用<code>split</code></p>
<pre><code>>>> out = []
>>> for s in l:
num = s.replace(' ','').split('=')[1]
#note : removed whitespace so don't have to deal with cases like
# `n = 2` or `n=2`
out.append(float(num))
>>> out
=> [7.2, 8.0]
</code></pre>
<p>#驱动程序值:</p>
<pre><code>IN : l = ["Hight = 7.2","baselength = 8"]
</code></pre>