[Python] How to format printing an array in Python

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

  1. Stack

    Stack Membro Participativo

    I have an array of 10 elements and I can each of the elements print on a new line formatted 6.2f with

    print(f'{myArray:6.2f}', sep="\n")

    But I would like to create string containing what needs to be printed, add a few things and print that string, like:

    text = 'something ' + f'{myArray:6.2f}' + ' rest'
    print(text)


    How can I make that each element of myArray will be on a new line and formatted in text?

    Continue reading...

Compartilhe esta Página