例えばPythonであれば str.join()
を使えばリストなどの中身をprintできる。
$ python3
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a = ['a', 'b', 'c', 'd']
>>> print(','.join(a))
a,b,c,d
C++であれば std::copyと std::ostream_iteratorを使えばコンテナの中身をprintできる。
#include <iostream>
#include <iterator>
#include <vector>
int main() {
std::vector<std::string> v = {"a", "b", "c", "d"};
std::copy(v.begin(), v.end(), std::ostream_iterator<std::string>(std::cout, ","));
std::cout << std::endl;
}
$ g++ -std=c++11 print_container.cpp && ./a.out
a,b,c,d,