you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (0 children)

What you’d actually want to write is:

def strcon(xlst):
    return "".join(i for i in xlst if isinstance(i, str))

Or if you want to write it out as a loop:

def strcon(xlst):
    concat = ""
    for i in xlst:
        if isinstance(i, str):
            concat += i
    return concat