सूची समझ को छोड़कर प्रयास करें

कोड उदाहरण

0
0

पायथन क्या आप सूची समझ को छोड़कर कोशिश कर सकते हैं

def catch(func, *args, handle=lambda e : None, **kwargs):  
     try:  
         return func(*args, **kwargs)  
     except Exception as e:  
         return handle(e)
0
0

सूची समझ को छोड़कर प्रयास करें

# 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.

अन्य भाषाओं में

यह पृष्ठ अन्य भाषाओं में है

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................