← Go Back

How to Print a List Without Brackets

When using print() to print a list, it will be printed as it was defined:

languages = ["Python", "Java", "C++", "PHP"]
print(languages) # ['Python', 'Java', 'C++', 'PHP']

To prevent the square brackets (and quotes in strings) from appearing, you can use:

print(", ".join(map(str, languages)))  # Python, Java, C++, PHP

This code also supports tuples.

lists


🐍 You might also find interesting: