Hi guys i have below code . trying to separate number,alphabet,alphanumeric from the string
import re
test_str = " Delivery Centre Strategy & Operations - 17762-DCSO"
def manipulate(test_str):
label = test_str.lstrip()
number =''
albhabet=''
res = re.split(r'[-_&\s]\s*', label)
print(res)
while("" in res):
res.remove("")
print(res)
for i in res:
i=i.lstrip()
print("i ->", type(i),i )
if i.isalpha():
albhabet +=i
albhabet +=' '
elif i.isdigit():
print(type(i))
number = number + i
print(type(number))
elif i.isalnum:
al=''
nu=''
for k in range(0,len(i)):
if i[k].isdigit():
nu +=i[k]
elif i[k].isalpha():
al +=i[k]
number +=nu
albhabet +=al
albhabet +=" "
if not number:
number = None
return number,albhabet
result = manipulate(test_str)
app_name = result[1]
ARI = result[0]
print (ARI,app_name)
i am getting the below error for this code :
number = number + i
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
Could you suggest why i getting this error as i am sure that 'i' is of string type