0

we face the problem while taking multi-line input for strings in python.

s=str(input("enter string"))

when i enter the input for suppose let us assume that i entered my input as:

hello friends!!
good morning

when i try to print this i get only 'hello friends!!'

is there any other code to take until i press a special symbol to tell to compiler that it is EOF of my input like in c we have code like scanf("%[^~]",str); it takes the input until we press "~" symbol.

like this do we have any special operations in python.

expected output of above program is

hello friends!! good morning
Andrej Kesely
  • 168,389
  • 15
  • 48
  • 91

1 Answers1

-1

This has been asked here many times. Please use the search function or click here: How to get multiline input from user

tldr:

import sys
msg = sys.stdin.readlines()
bkd
  • 170
  • 12