Mat*_*hew 2 python input operator-overloading
在C++中,您可以这样做以轻松地将数据读入类中:
istream& operator >> (istream& instream, SomeClass& someclass) {
...
}
Run Code Online (Sandbox Code Playgroud)
在python中,我可以找到从控制台读取的唯一方法是"raw_input"函数,它不能很好地适应这种事情.是否有一种pythonic方式来解决这个问题?