How to remove square brackets from list in Python?

You could convert it to a string instead of printing the list directly: If the elements in the list aren’t strings, you can convert them to string using either repr (if you want quotes around strings) or str (if you don’t), like so: Which gives the output:

How do I print out the contents of a vector?

If you have a C++11 compiler, I would suggest using a range-based for-loop (see below); or else use an iterator. But you have several options, all of which I will explain in what follows. range-based for-loop (C++11) In C++11 (and later) you can use the new range-based for-loop, which looks like this: The type char … Read more