-2

I Have following Array in python,

   [4,5,6]

i want my output as
['4','5','6']

How to Do that?

1
  • 1
    Have you tried anything?.. There are many ways to do it Commented Sep 21, 2020 at 11:50

2 Answers 2

0

Use map to convert list of integer to list string:

arr = [4,5,6]    
arr = list(map(str,arr))
arr

Result :

['4', '5', '6']
Sign up to request clarification or add additional context in comments.

Comments

0

I suppose you want your integers represented as strings, so i suggest a list comprehension:

alpha = [4,5,6]
alpha = [str(i) for i in alpha]
print(alpha)

Output:

['4', '5', '6']

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.