Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Python by (12.7k points)

Let me say I have a program with 'n' number of lines of input. In that input , each line consist of two space seperated values, let's say first one is the salary of the employee and second one will be the name of the employee

46000 Sabarish

30000 Santhosh

31000 Shalini

14700 Suresh

This is an example of my input.

So, how to read this kind of input in python ? Please help me with this!

1 Answer

0 votes
by (26.4k points)

You can use two functions here for reading space separated input in python

the_string_s=raw_input()

salary,name=the_string_s.split()

Want to be a Python expert? You can join this Python Course

To know more about these topics, you can also look at the following video tutorial

Browse Categories

...