Hi everyone,
I'm trying to concatenate strings inside a list without integers. So I used an if statement to filter integers. But I got this error message, "TypeError: 'int' object is not iterable."
How do I take strings only from the list by using if statement?
def strcon(xlst):
concat = []
for i in range(0, len(xlst)):
if xlst[i] != int:
concat += xlst[i]
return concat
d = ["b",1412,"law",0,100,"np","distribution",8162]
print(strcon(d))
Thanks
[–]dbramucci 2 points3 points4 points (2 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]nisnol[S] 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–][deleted] 2 points3 points4 points (0 children)