Python Problems with Too Big List

Asked

Viewed 122 times

0

I’m making a Python script and I’m getting an msg error I can’t fix

x = [int(e) for and in input(). split()]

msg of error: Memoryerror Command exited with non-zero status (1)

tried to use map:

x = list(map(int, input(). split()))

msg of error: Memoryerror Command exited with non-zero status (1)

Generally the entries do not exceed 10,000 numbers and the computer has 32Gb of RAM? What can I do, the OS is 64bit?

  • 1

    I couldn’t play. The error happens when you do entrada = input() and glue the result? I suspect it has to do with the input buffer, not the conversion to int.

  • When I put more than 10000 entries in the input, the error happens! I saw in the documentation that the list has a limitation of entries in 12000 elements, I tried to create a txt with saving the file, but I can’t use the data as lists in the same way.

  • @weltonvaz input() with more than 10 thousand elements has no sense, are input data via keyboard as far as I remember, it is insane for a user to enter this amount of elements is not no ?

1 answer

-1

My dear, your script is not wrong, I have tested it myself in my compiler and accepted it correctly, something must be happening with your compiler or related thing, since I just tested it and gave no error, in case you want to send pictures could be easier to help you.

  • Python has a limitation on the number of elements in a list, this is the problem. Since I’m new, I couldn’t get him to write the input to a txt and then recover the line with the data (any integer). He always has to read the full txt to access the line I need, this is time consuming and costly

  • Exactly, he has to do this every time because he does not have the ability to go only in the place and take the whole, a big problem and in this case brings the error, unfortunately has no way to fix it.

  • Thanks Eron! I already tried to create a file in memory with "import tempfile", but it does not save lists.

  • Dboas man, computing is limited, nothing we can do, just follow

Browser other questions tagged

You are not signed in. Login or sign up in order to post.