In the first case, you have the string "{u'name': u'machine', u'value': 71.3, u'time': 136.648}"
. This is not a dictionary - it is a string. You're trying to access a string key of a string, but strings don't have string keys, they only have integer indices.
In the second case, you parse the string (via JSON) and you get a dictionary, which you then access.
Perhaps this will help:
>>> a = [{u'time': 136.648, u'name': u'machine', u'value': 71.3}]
>>> b = str(a)[1:-1]
>>> c = '{"time": 136.648, "name": "machine", "value":71.3}'
>>> d = json.loads(c)
>>> a
[{u'name': u'machine', u'value': 71.3, u'time': 136.648}]
>>> type(a)
<type 'list'>
>>> a[0]
{u'name': u'machine', u'value': 71.3, u'time': 136.648}
>>> a[0]['time']
136.648
>>> b
"{u'name': u'machine', u'value': 71.3, u'time': 136.648}"
>>> type(b)
<type 'str'>
>>> b[0]
'{'
>>> b['time']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: string indices must be integers, not str
>>> c
'{"time": 136.648, "name": "machine", "value":71.3}'
>>> type(c)
<type 'str'>
>>> c[0]
'{'
>>> c['time']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: string indices must be integers, not str
>>> d
{u'name': u'machine', u'value': 71.3, u'time': 136.648}
>>> type(d)
<type 'dict'>
>>> d['time']
136.648