All Courses

how to converting a list to a string?

By Jennifer, a year 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

Bootcamp Session : Python for Artificial Intelligence.

Oct 2nd (4:00 PM) 173 Registered
More webinars

Related Discussions

Running random forest algorithm with one variable

View More