Question: I have a dictionary like:

```
D = {0: [[' 11', '3', '6', '8']], \
     1: [[' 2']], \
     2: [[' 0', '2734', '394']], \
     3: [[' 1', '1163', '1216', '13', '181', '33', '379']]}

```

Things I want to do:

1. Remove extra list from its value
2. convert each element from its value into integer.

I tried a little like:

> 
> 
> ```
> for k,v in D.items():
>         D[k] = [i.split(',') for i in D[k] int(i) ]
> 
> ```
> 
> 

But it does not work.

Answer: 
Seems what you want is a dictionary with the value list unwrapped and converted to integers;

```
{x:[int(z) for z in y[0]] for x,y in D.iteritems()}

```

`D.iteritems()` returns all key/value pairs to iterate over, the key goes to x, the value goes to y. We iterate over y[0] (the inner list) to get the integer value for all elements, and turn them back into a list, resulting in;

```python
{x:[int(z) for z in y[0]] for x,y in D.iteritems()}
# {0: [11, 3, 6, 8], 
#  1: [2], 
#  2: [0, 2734, 394], 
#  3: [1, 1163, 1216, 13, 181, 33, 379]}

```
Try this

```
for k,v in D.items(): D[k] = [int(i.strip()) for i in v[0]]

```

`v` should be `[[' 11', '3', '6', '8']]` and `v[0]` should be the inner list `[' 11', '3', '6', '8']`.