I have a list by connection of two strings and then converting them to integer by:
for i in xrange(0, len(FromBus[1][0])):
FromBus[1][0][i] = int(str(FromBus[1][0][i]) + str(ToBus[1][0][i]))
List looks as following:
>>> FromBus[1][0][1:5]
[3724637724L, 3724837324L, 3724837707L, 3724837707L]
List is made of longs
>>> type(FromBus[1][0][1])
<type 'long'>
Due to post processing of data in different environment I am trying to convert the long type to integer type so I need to delete 'L' at the end of each variable. However, all of the methods I have found, failed:
>>> int(FromBus[1][0][1])
3724637724L
>>> [int(i) for i in FromBus[1][0]][1:5]
[3724637724L, 3724837324L, 37248377071L, 37248377072L]
>>> map(int, FromBus[1][0][1:5])
[3724637724L, 3724837324L, 37248377071L, 37248377072L]
My question is, what is the source of the problem here? I can easily convert them to strings. But how can I still convert long to int, without doing it thorugh string method (convert long to strings deleting the last character at the end of each string and then converting it back again to integer).
Sufficient solution for me, would be also to manimulate csv writing function deleting 'L''s while writing.