Is there a scanf() or sscanf() equivalent in python?

0 votes
Is there a scanf() or sscanf() equivalent in python? scanf() is a very good way to get user input. Can you tell me something like this for python?
Jul 29, 2019 in Python by Ashish
849 views

1 answer to this question.

0 votes
There is nothing as such for python.

For simple input parsing, the easiest way is usually to split the line into whitespace-delimited words using the split() method of string objects and then convert decimal strings to numeric values using int() or float().
answered Jul 29, 2019 by Greg

Related Questions In Python

0 votes
1 answer

Is there a label/goto in Python?

No, Python does not support labels and ...READ MORE

answered Aug 1, 2018 in Python by Priyaj
• 57,530 points
148 views
0 votes
1 answer

How does Python know whether a variable in the class is a method or a variable?

In python objects/variables are wrapped into methods ...READ MORE

answered Sep 18, 2018 in Python by aryya
• 7,350 points
71 views
0 votes
1 answer

Is there a string 'contains' in python?

In this case, you can use the ...READ MORE

answered Sep 25, 2018 in Python by SDeb
• 13,230 points
88 views
0 votes
1 answer

Is there a stack/heap in Python?

Memory management in Python involves a private ...READ MORE

answered Nov 9, 2018 in Python by SDeb
• 13,230 points
484 views
0 votes
1 answer
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 650 views
0 votes
0 answers
+4 votes
6 answers
0 votes
1 answer

Is there a foreach function in python and is there a way to implement it if there isnt any

Every occurence of "foreach" I've seen (PHP, ...READ MORE

answered Aug 31, 2018 in Python by charlie_brown
• 7,750 points
115 views
0 votes
2 answers

Check a number is Prime or not in Python

There is an efficient way to write ...READ MORE

answered Oct 26, 2018 in Python by Priyaj
• 57,530 points
654 views