аватар question@mail.ru · 01.01.1970 03:00

Multi -line input ()

How can you make a multi-line Input (), because this function when entering certain characters and then press on Enter if the program consists only of

  a =  input  ()   print  (a)     

just the question: is it possible to make an Input () end when clicking on a certain button, for example, ESC

аватар answer@mail.ru · 01.01.1970 03:00

I don’t know how to finish the introduction of a particular key, but I know another way:

  Var =  "\ n" " .join ( iter  ( input ,  "" "" ))     

in this case, the entry will end when pressing Enter on an empty line.


times people are plus, then I think it is worth explaining the code:
iter (input, "" "" "" "" "" "" "" "" "" "" "" "" "" input () will not retu the empty line ( "" "" ). Next, we simply combine through "\ n" " all the results from this generator.

Latest

Similar