# Python program to convert a list
# to string using list comprehension
s = ['I', 'want', 4, 'apples', 'and', 18, 'bananas']
# using list comprehension
listToStr = ' '.join([str(elem) for elem in s])
print(listToStr)
# Python program to convert a list
# to string using list comprehension
s = ['I', 'ate', 2, 'shake', 'and', 3, 'chocolates']
# using list comprehension
listToStr = ' '.join([str(element) for element in s])
print(listToStr)
ArrayList<String> list = new ArrayList<String>();
list.add("one");
list.add("two");
list.add("three");
StringBuilder sb = new StringBuilder();
for (String s : list)
{
sb.append(s);
sb.append(" ");
}
System.out.println(sb.toString());
https://mefiz.com/ # For Developer
import random
n = random.sample(range(1,51214), 5)
listToString = ''.join([str(elem) for elem in n])
print(n)
print(listToString)
using System;
using System.Collections.Generic;
public class Example
{
public static void Main()
{
List<string> list = new List<string>() { "A", "B", "C" };
char delim = ',';
string str = String.Join(delim, list);
Console.WriteLine(str);
}
}
/*
Output: A,B,C
*/