Input read more than one line of the string

2

I'm having a problem, my code needs to read a string that contains more than one line, however, it reads the first and to, as if when the line is skipped, it interpreted as an "enter." >

def depositlist():
deplist = str(input('''Entre com a lista de depósitos: '''))
clear = re.findall(':.+[.)$]', deplist)
print(clear)

I need it to read the list below and separate the rows for the values, excluding the blank line and the time.

1) #9ea587 - EXEMPLO DOS SANTOS - 4000,00 BRL - Neon


[4:46] 
2) #1abcd45 - FULANO DA SILVA- 1000,00 BRL - Santander
    
asked by anonymous 15.12.2017 / 04:39

1 answer

3

You could create a function to read multiple lines whereas processing will be interrupted when there is more than one N number of line breaks.

Example (for N > 1):

def get_input():
    input('''Entre com a lista de depósitos: ''')
    lines = []
    count_line_break = 0
    while True:
        line = input()
        if not line:
            count_line_break = count_line_break + 1
        if count_line_break <= 1:
            lines.append(line)
        else:
            break
    text = '\n'.join(lines)
    return(str(text))

And your call would look like this:

deplist = get_input()

Adapted from link

    
15.12.2017 / 11:35