Backwards-compatible input calls in Python

后端 未结 4 1744
囚心锁ツ
囚心锁ツ 2020-12-01 18:12

I was wondering if anyone has suggestions for writing a backwards-compatible input() call for retrieving a filepath?

In Python 2.x, raw_input worked fine for input l

4条回答
  •  囚心锁ツ
    2020-12-01 18:31

    You could import the function:

    from builtins import input
    

    Unfortunately though this method requires an external dependency via pip install future

提交回复
热议问题