Splitting strings unhashable type
<p>I have never split strings in Python before so I am not too sure what is going wrong here. </p>

<pre><code>import pyowm

owm = pyowm.OWM('####################')

location = owm.weather_at_place('Leicester, uk')
weather = location.get_weather()
weather.get_temperature('celsius')
temperature = weather.get_temperature('celsius')

print(temperature[5:10])
</code></pre>

<p>Error received </p>

<pre><code>sudo python weather.py
Traceback (most recent call last):
File "weather.py", line 10, in &lt;module&gt;
print(temperature[5:10])
TypeError: unhashable type
</code></pre>

<p><code>get_temperature</code> returns a dictionary, which you're then trying to index with a <code>slice</code> object, which is not hashable. e.g.</p>

<pre><code>&gt;&gt;&gt; hash(slice(5, 10))                                                                         
Traceback (most recent call last):                                                             
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;                                                          
TypeError: unhashable type
</code></pre>

<p>To get the temperature, you need to get it from the dictionary like this:</p>

<pre><code>temperature['temp']
</code></pre>

python python-3.x