抛错

1、PHP抛错php

// 正确的抛出异常python

try {
  if (file_exists('test_try_catch.php')) {     require ('test_try_catch.php');   } else {     throw new Exception('file is not exists');//throw扔出去,catch会抓到错误信息   } } catch (Exception $e) {   echo $e->getMessage(); }

 

2、python抛错ui

try:
    result = data.query('(name=="&")and(age>=20)') print(result) except Exception as e://这行不动,原样写
print('Error:', e)

没有报错的时候输出:  spa

   id name  age
4   5    &   20

报错的时候输出:code

Error: invalid syntax (<unknown>, line 1)
相关文章
相关标签/搜索