M
M
Meezmo2021-10-08 19:03:34
Python
Meezmo, 2021-10-08 19:03:34

Why doesn't the split function return all values ​​in a list?

I have a file with two lines. The first contains one number, and the second contains 5 numbers separated by a space. Here is the code:

file = open('standard input.txt', 'r')
n = int(file.readline())
t = str(file.readline())
t1 = t.split(' ')

And here is the txt file:
5
30 45 30 35 30
When I run the program, only numbers 45 and 35 appear in the list t1. How to solve this problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question