Question: I am attempting to write C functions with these two prototypes:

```
int extract_little (char* str, int ofset, int n);
int extract_big(char* str, int ofset, int n);

```

Now the general idea is I need to return a n byte integer in both formats starting from address str + ofset. P.S. Ofset doesn't do anything yet, I plan on (trying) to shuffle the memory via an offset once I figure out the little endian, for the big. 

I'v trying to get it to output like this; for little endian, based off of `i=0xf261a3bf;`,
0xbf 0xa3 0x61 0xf2

```
int main()
{
    int i = 0xf261a3bf;
    int ofset = 1; // This isn't actually doing anything yet
    int z;
    for (z = 0; z < sizeof(i); z++){ 
        printf("%x\n",extract_little((char *)&i,ofset, sizeof(i)));
    }
    return 0;
}

int extract_little(char *str,int offs, int n) {
    int x;
    for (x = 0; x < n; x++){
        return str[x];
    }
}

```

I'm not sure what else to try. I figured out the hard way that even thought I put it in a for loop I still can't return more than 1 value from the return. 

Thanks!

Answer: 
It is possible to recover the data:

```
In [41]: a = {'0': {'A': array([1,2,3]), 'B': array([4,5,6])}}

In [42]: np.savez('/tmp/model.npz', **a)

In [43]: a = np.load('/tmp/model.npz')

```

Notice that the dtype is 'object'. 

```
In [44]: a['0']
Out[44]: array({'A': array([1, 2, 3]), 'B': array([4, 5, 6])}, dtype=object)

```

And there is only one item in the array. That item is a Python dict!

```
In [45]: a['0'].size
Out[45]: 1

```

You can retrieve the value using the `item()` method (NB: this is *not* the
`items()` method for dictionaries, nor anything intrinsic to the `NpzFile`
class, but is the [`numpy.ndarray.item()` method](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.ndarray.item.html)
that copies the value in the array to a standard [Python scalars](http://docs.scipy.org/doc/numpy-1.10.1/user/basics.types.html#array-scalars). In an array of `object` dtype any value held in a cell of the array (even a dictionary) is a Python scalar:

```
In [46]: a['0'].item()
Out[46]: {'A': array([1, 2, 3]), 'B': array([4, 5, 6])}

In [47]: a['0'].item()['A']
Out[47]: array([1, 2, 3])

In [48]: a['0'].item()['B']
Out[48]: array([4, 5, 6])

```

---

To restore `a` as a dict of dicts:

```
In [84]: a = np.load('/tmp/model.npz')

In [85]: a = {key:a[key].item() for key in a}

In [86]: a['0']['A']
Out[86]: array([1, 2, 3])

```
Based on this answer: [recover dict from 0-d numpy array](https://stackoverflow.com/questions/8361561/recover-dict-from-0-d-numpy-array)

After 

```
a = {'key': 'val'}
scipy.savez('file.npz', a=a) # note the use of a keyword for ease later

```

you can use

```
get = scipy.load('file.npz')
a = get['a'][()] # this is crazy maybe, but true
print a['key']

```

It would also work without the use of a keyword argument, but I thought this was worth sharing too.