Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Print array value without brackets in Python

So, I have an array value like this

"Items": [
            "*.abc.com",
            "*.xyz.me"
        ]

with print(Items) it’s returning ['*.abc.com', '*.xyz.me']
but, I want to print everything without brackets like '*.abc.com', '*.xyz.me'

Followed some way, but those are returning different not exactly what I want.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

what about this?

t = [
            "*.abc.com",
            "*.xyz.me"
        ]

t = str(t)
print(t[1:-1])

Output:

'*.abc.com', '*.xyz.me'

i add a short description like mozway suggests:

you convert your python list to a string (at this step the [ ] are still there).
After that, you print the string, strarting at index 1, (include) (so it’s excludes the first one who is ‘[‘) until the last one (exclude) who is ‘]’

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading