문제

If I define a function, is it ever possible that an exception would be raised for kwargs.get? For example,

def func(**kwargs):
    try:
        a = kwargs.get("a")
    except Exception as e:
        raise ValueError("Would I ever see this error? \n ERROR: %s" % e )
도움이 되었습니까?

해결책

No, kwargs.get('somestring') will not raise an exception; you are passed a standard Python dict type in that case.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top