how to converting a list to a string?

By Jennifer, 7 months ago
  • Bookmark
0

convert following list into string

list1 = ["India", "is","my","country"]

List
String
1 Answer
0

You can simply use join() for this in the print function

list1 = ["India", "is","my","country"]
str1 =" ".join(list1)

print(str1)    #output   India is my country

type(str1)    #output  str

Your Answer

Webinars

Live Masterclass on "Python for Artificial Intelligence"

Dec 4th (7:00 PM) 214 Registered
More webinars

Related Discussions

Running random forest algorithm with one variable

View More