+ 1

how can elements of a string be converted to an integer?

ex: arr= 07:25:32, can these array elements be separated to individual numbers??

23rd Jun 2016, 5:48 AM
pranjal
3 Respuestas
0
isn't that an integer array?
23rd Jun 2016, 7:32 AM
nived punchayil
nived punchayil - avatar
0
but it has colons in between
23rd Jun 2016, 7:35 AM
pranjal
0
so if your arr is string arr = '07:25:32' You can get list of items. Split it! arr = arr.split(':') and then u can get each list element as int int(arr[0]) #will give you 7
23rd Jun 2016, 11:06 AM
John Doe
John Doe - avatar