[Python] How to assign print output to a variable?

Discussão em 'Python' iniciado por Stack, Fevereiro 13, 2025.

  1. Stack

    Stack Membro Participativo

    How to assign the output of the print function (or any function) to a variable?

    To give an example:

    import eyeD3
    tag = eyeD3.Tag()
    tag.link("/some/file.mp3")
    print tag.getArtist()


    How do I assign the output of print tag.getArtist to a variable?

    Continue reading...

Compartilhe esta Página