📜  在列表理解中尝试 except - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:56.636000             🧑  作者: Mango

代码示例2
# Python List Comprehension Error Handling:
# The correct responses to the question "how to handle exceptions in a list 
# comprehension" are all expressing part of all of this truth: 1) literally, 
# i.e. lexically IN the comprehension itself, you can't; 2) practically, you 
# delegate the job to a function or check for error prone values when that's 
# feasible.