[Python] Set and List issue in Python3 [closed]

Discussão em 'Python' iniciado por Stack, Agosto 8, 2025.

  1. Stack

    Stack Membro Participativo

    I want to get the output as set1 without square brackets. But when I use below code, I'm losing both braces. How can I get required output as mentioned below?

    set1 = (['abc', 'xyz', 'pqr'])
    print(str(set1).replace("[","").replace("]",""))


    Current output when I use above code: 'abc', 'xyz', 'pqr'

    Required output: ('abc', 'xyz', 'pqr')

    Continue reading...

Compartilhe esta Página