[Python] Converting a string into a list in Python

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

  1. Stack

    Stack Membro Participativo

    I have a text document that contains a list of numbers and I want to convert it to a list. Right now I can only get the entire list in the 0th entry of the list, but I want each number to be an element of a list. Does anyone know of an easy way to do this in Python?

    1000
    2000
    3000
    4000


    to

    ['1000','2000','3000','4000']

    Continue reading...

Compartilhe esta Página