Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk2 min

How to Remove Brackets From a List in Python

Use join for a formatted string or unpack the list into print for direct output. Learn which approach works for strings, numbers, and mixed values.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To print a list without its square brackets, format its elements as a string rather than printing Python’s list representation. For a list of strings, use ', '.join(items). For numbers or mixed values, convert each value with str before joining, or unpack the list into print for immediate output.

Why Python shows brackets

Square brackets are part of how Python represents a list; they are not extra characters surrounding the stored elements. Formatting the output does not remove items or change the list itself. Python’s data structures documentation describes lists and their standard representation.

Print a list of strings without brackets

Use str.join with the separator you want. The separator goes before .join:

items = ['red', 'green', 'blue']
result = ', '.join(items)
print(result)
# red, green, blue

This produces a reusable string, with no list brackets or quotes. Change the separator to control the format: ' '.join(items) inserts spaces, while ''.join(items) puts the strings together with no separator.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The Python 3.14.8 built-in types documentation specifies that join concatenates strings from an iterable and raises TypeError if an element is not a string.

Handle numbers and mixed values

Convert each element to a string before joining when the list contains numbers or a mix of types:

values = [10, 20, 30]
print(', '.join(map(str, values)))
# 10, 20, 30

mixed = [10, 'ten', True]
print(', '.join(map(str, mixed)))
# 10, ten, True

map(str, values) applies str to each element, so join receives strings. The result is text, not a list of converted values.

Print items directly without building a string

If you only need to write the values to standard output, unpack the list into print and set its separator:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
values = [10, 'ten', True]
print(*values, sep=', ')
# 10, ten, True

Use sep=', ' for comma-separated output. Without that argument, print(*values) separates items with spaces. Unpacking is convenient for immediate printing; use join when you need a string to save, return, or use elsewhere. See the Python tutorial’s discussion of printing and strings.

Why slicing or replacing brackets is usually a bad fit

Expressions such as str(items)[1:-1] or str(items).replace('[', '').replace(']', '') edit the text of the list’s representation instead of formatting its elements. Slicing can leave quotes around string values; replacement can also remove bracket characters that belong inside an element. Use join or unpacked print to choose the output format deliberately.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

If brackets are inside the list’s strings

If you want to remove square-bracket characters from the stored strings themselves, transform those strings explicitly. This is different from omitting the brackets in the display of a list:

items = ['[red]', '[green]']
cleaned = [item.replace('[', '').replace(']', '') for item in items]
print(cleaned)
# ['red', 'green']

The new list contains changed strings; the original items list remains unchanged.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What if the list contains nested lists?

Formatting the outer list does not flatten nested data. First decide whether you want to preserve the nested structure or flatten the elements into one sequence. Then format that chosen result. Removing the outer representation characters alone will not turn nested lists into a flat list.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.