[Python] How to save specific split of output from terminal in text file using python VS code...

Discussão em 'Python' iniciado por Stack, Janeiro 9, 2025.

  1. Stack

    Stack Membro Participativo

    For example, the output from the terminal is:

    1 2 3 4 5 6
    2 3 4 5 6 7
    1 2 5 7 4 7
    1 2 6 7 9 3
    2 4 7 3 1 7


    (the numbers are purely random and there are unlimited lines not just 5, you can see the picture): [​IMG]

    And i want to save all the numbers in the second split which are

    2
    3
    2
    2
    4


    in a text file. So far i only learned how to write all the output, but i have no idea of how to save the specific split i want. Can anyone help? Thanks in advance!

    Continue reading...

Compartilhe esta Página