Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 Python 中修复参数类型?
def truncus(fill=int): return [i for i in range(fill)]
def truncus(fill): if type(fill) != int: raise Exception("A non-integer value was passed to truncus.") return [i for i in range(fill)]