프로그래밍 Programming
except Exception, e : SyntaxError: invalid syntax
문장전달자
2016. 3. 13. 11:45
728x90
1 2 | except Exception, e : return "Error:%s" % str(e) | cs |
위의 에러는 파이썬3에서는 더 이상 컴마로 구분하는 것을 허용하지 않기 때문이다.
, 대신 아래와 같이 as 를 사용하면 된다.
as 는 파이썬 2.7 과도 호환된다.
1 2 | except Exception as e : return "Error:%s" % str(e) | cs |
728x90