Python Forum
storing lines from stdin in a list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
storing lines from stdin in a list
#3
You haven't been clear on what help you need. As j.crater said, we don't write code for you but we will help correct it. Without you sharing some code, we have no idea how much you known and where you are having problems.

input('enter something: ') is the command to get something from he user on stdin.

You can use a loop for or while to get several things entered. Just add them to a list. Lists in python don't care if different entries have different types.

You can use the int() function to covert strings containing binary data to decimal. Sorting a list of binary strings will give you 'ascii' rather than numerical order. Sorting is easy though, as there are built in functions for that.
I am trying to help you, really, even if it doesn't always seem that way
Reply


Messages In This Thread
storing lines from stdin in a list - by bghosh - May-02-2018, 12:57 PM
RE: storing lines from stdin in a list - by gruntfutuk - May-02-2018, 01:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  When is stdin not connected to a tty, but can still be used interactively? stevendaprano 1 1,951 Sep-24-2022, 05:06 PM
Last Post: Gribouillis
  STDIN not working H84Gabor 3 6,202 Sep-06-2021, 08:10 AM
Last Post: H84Gabor
  Iterate 2 large text files across lines and replace lines in second file medatib531 13 8,940 Aug-10-2020, 11:01 PM
Last Post: medatib531
  how do i get rid of next lines in my list() ironpotatoe58 10 5,535 Mar-31-2020, 03:57 AM
Last Post: SheeppOSU
  How to read a file using stdin? pyth0nus3r 1 3,636 Aug-24-2019, 01:14 AM
Last Post: Larz60+
  What is the sys.stdin.isatty() command? pyth0nus3r 2 14,395 Aug-22-2019, 04:37 PM
Last Post: pyth0nus3r
  getting error "exec_proc.stdin.write(b'yes\n') IOError: [Errno 32] Broken pipe" Birju_Barot 0 3,573 Jul-23-2019, 11:50 AM
Last Post: Birju_Barot
  is it safe to close stdin Skaperen 1 3,750 Apr-04-2019, 06:57 AM
Last Post: Gribouillis
  Need help with reading input from stdin into array list Annie123 2 6,272 Mar-24-2019, 01:19 PM
Last Post: Annie123
  25 blank lines in my sorted_fruits output list! raven61 7 5,516 Aug-09-2018, 11:30 PM
Last Post: raven61

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020