if_stmt ::= "if" assignment_expression ":" suite
("elif" assignment_expression ":" suite)*
["else" ":" suite]
Utilisation:
if EXPRESSION1:
SUITE1
elif EXPRESSION2:
SUITE2
else:
SUITE
Opérateur commun:
with_stmt ::= "with" ( "(" with_stmt_contents ","? ")" | with_stmt_contents ) ":" suite
with_stmt_contents ::= with_item ("," with_item)*
with_item ::= expression ["as" target]
Utilisation:
with EXPRESSION as TARGET:
SUITE
Ou
with A() as a, B() as b:
SUITE
Ou
with A() as a:
with B() as b:
SUITE
Ou
with (
A() as a,
B() as b,
):
SUITE
match_stmt ::= 'match' subject_expr ":" NEWLINE INDENT case_block+ DEDENT
subject_expr ::= star_named_expression "," star_named_expressions?
| named_expression
case_block ::= 'case' patterns [guard] ":" block
Utilisation:
match variable: #Ici.variableC'est ce qu'il faut juger
case ["quit"]:
statement_block_1 # Code d'exécution du cas correspondant,Quandvariable="quit"Exécution àstatement_block_1
case ["go", direction]:
statement_block_2
case ["drop", *objects]:
statement_block_3
... # AutrescaseDéclarations
case _: #Et sicaseInstruction manquée,Exécuter ce bloc de code,Similaire àSwitchDedefault
statement_block_default
Logistic regression algorithm
List of articles 1、 Problem de
# 01_mnist_demo.py # Usi
當完成某個功能模塊開發後