พยายามยกเว้นอยู่ในรายการรู้จักเล

รหัสตัวอย่าง

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

ดังอยู่ในนี้หมวดหมู่

ดังหน้ากับตัวอย่างอยู่ในหมวดหมู่