number_of_fails(['1','2','3']) # this is my current array, I want it to be int
coverted_nof = int(number_of_fails) # what I tried to do to convert to an int
output:
TypeError: only size-1 arrays can be converted to Python scalars
number_of_fails(['1','2','3']) # this is my current array, I want it to be int
coverted_nof = int(number_of_fails) # what I tried to do to convert to an int
output:
TypeError: only size-1 arrays can be converted to Python scalars
array = ['a1', '2', '3', '4', '5']
for i in range(0, len(array)):
if array[i].isdigit():
array[i] = float(array[i])
print ("Modified list is : " + str(array))
Modified list is : ['a1', 2.0, 3.0, 4.0, 5.0]