how to converting a list to a string?

By Jennifer, 2 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

How To Land a Job in Data Science

Jun 24th (7:00 PM) 238 Registered
More webinars

Related Discussions

Running random forest algorithm with one variable

View More