About 25,000,000 results
Open links in new tab
  1. python - How to get multiline input from the user - Stack Overflow

    To get multi-line input from the user you can go like: no_of_lines = 5 lines = "" for i in xrange(no_of_lines): lines+=input()+"\n" print(lines) Or. lines = [] while True: line = input() if …

  2. How to get user input for multiline lines in Python 3?

    Aug 25, 2020 · Is there a beginner-friendly way to accept multiline user string inputs as variables? A common way of doing this in programs is to have an "I'm done" string (e.g. a single period), …

  3. python - How to read multiple lines of raw input? - Stack Overflow

    Oct 17, 2021 · The easiest way to read multiple lines from a prompt/console when you know exact number of lines you want your python to read, is list comprehension. lists = [ input() for i in …

  4. Taking multiple inputs from user in Python - GeeksforGeeks

    Dec 3, 2024 · One of the simplest ways to take multiple inputs from a user in Python is by using the input() function along with the split() method. The split() method splits a string into a list …

  5. How to Get Multiple-Line Input in Python - Delft Stack

    Feb 20, 2025 · We explored diverse approaches, starting from the raw_input() function in Python 2, adapting it to Python 3’s input() function, and utilizing the iter() function for an efficient …

  6. Multiple lines user Input in Python - bobbyhadz

    Apr 9, 2024 · To take multiple lines of user input: Use a while loop to iterate for as long as the user is typing in values. On each iteration, append the user input and a newline character to a …

  7. Taking multiline input from a user in Python - Learn By Example

    Explore methods for taking multiline input from a user in Python, including reading a specific number of lines, reading until a terminator, and capturing input until an EOF signal is received.

  8. Multi-Line printing in Python - GeeksforGeeks

    Jan 21, 2019 · When working with lists in Python sometimes it's necessary to print the elements vertically. This can be useful when we want to display each item on a new line or present data …

  9. Python – Multi-Line Statements - GeeksforGeeks

    May 10, 2023 · In Python, we can return multiple values from a function. Following are different ways 1) Using Object: This is similar to C/C++ and Java, we can create a class (in C, struct) to …

  10. Top 2 Ways to Capture Multiple Lines of Input in Python

    Nov 24, 2024 · Here, we delve into two effective approaches to accomplish this task in Python. Method 1: Using Iteration with Sentinel Value. One straightforward method to collect multiple …

Refresh