Skip to content
Advertisement

In which Python module is the input() function?

I’m making a module which is meant to convert an integer parameter into a roman numeral string and am trying to find out where the input() function is ’cause I’d like to be able to save the roman numeral product to a variable in a manner similar to the one in the input() function, that is:

JavaScript

Advertisement

Answer

It’s in the builtins module.

JavaScript

In Python 2, it was called __builtin__. But note that Python 3’s input() is like Python 2’s raw_input().


If you want to implement your own custom input function, you can read from sys.stdin just like a file.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement