0 votes
1 view
in Python by (47.7k points)

I need to join a list of items. Many of the items in the list are integer values returned from a function; i.e.,

myList.append(munfunc())

How should I convert the returned result to a string in order to join it with the list?

Do I need to do the following for every integer value:

myList.append(str(myfunc()))

Is there a more Pythonic way to solve casting problems?

1 Answer

0 votes
by (107k points)

You can use the below-mentioned code to join a list of items with different types as a string in Python:-

a=[1,2,3] 

b=[str(x) for x in a] 

print b

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...