ModularM
Modular2y ago
30 replies
MyriadColors

How to take user input form the terminal?

Self-explanatory, the best I could find with research was:

from python import Python

fn main() raises:
    var a = Python.evaluate("input('What is your name? ')").to_string()
    print(a)


I got this error:
What is your name? pedro
Unhandled exception caught during execution: 'str' object has no attribute 'to_string'
mojo: error: execution exited with a non-zero result: 1


So my questions:

1. How can I do it?

Thank you.
Was this page helpful?