BUG: Make python2 *.npy files readable in python3.

The Python2 generated file had long integer literals like '1L' that
broke in Python3. The fix here is to filter out the 'L' and let
safe_eval take care of the integer type in converting the string.

The fix here comes from Nathaniel Smith with a few added fixups.

Closes #5170.
TST: Add tests for Python2, Python3 *.npy compatibility.