I need to convert 'a b c' to 'abc' so made this code:
string = 'a b c'
result = [ch for ch in string if (ch != ' ')]
print(type(result))
result = str(result)
print(type(result))
print(result)
result of this code is expected as:
<class 'list'>
<class 'str'>
'abc'
but result is as:
<class 'list'>
<class 'str'>
['a', 'b', 'c']
why result is printed list? this makes faults in other part of my code.