Python Forum

Full Version: Insert a new column for Key Value
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello guys,

I'm using the following code to save my list in a TXT file.
import numpy as np 
a = [s.strip() for s in contents.splitlines()]

np.savetxt(r'C:\Users\bruno\Desktop\FII\LL.txt',  
           a, 
           delimiter ="\t",
           fmt ='% s')
How can I add a new column and fill with an automatic Key Number?

Something like this:
Key Number | Address | Lat | Long | Status
1 | Street 1 | -27.47 | -47.21 | OK
2 | Street 2 | -28.47 | -46.25 | OK
3 | Street 3 | -29.47 | -45.25 | NOK
4 | Street 4 | -25.47 | -44.27 | OK
5 | Street 5 | -24.47 | -43.28 | NOK