最佳答案
在 python 中有没有一种方法可以将 try/but 转换为单行?
比如..。
b = 'some variable'
a = c | b #try statement goes here
其中 b是一个声明的变量,而 c不是... 因此 c将抛出一个错误,而 a将成为 b..。