Replace .format with f-strings

main
Aurélien Geron 2021-11-22 10:17:46 +13:00
parent 599758a1bb
commit c4280cc354
1 changed files with 5 additions and 6 deletions

View File

@ -2259,10 +2259,9 @@
" return email\n",
" payload = email.get_payload()\n",
" if isinstance(payload, list):\n",
" return \"multipart({})\".format(\", \".join([\n",
" get_email_structure(sub_email)\n",
" for sub_email in payload\n",
" ]))\n",
" multipart = \", \".join([get_email_structure(sub_email)\n",
" for sub_email in payload])\n",
" return f\"multipart({multipart})\"\n",
" else:\n",
" return email.get_content_type()"
]
@ -2742,8 +2741,8 @@
"\n",
"y_pred = log_clf.predict(X_test_transformed)\n",
"\n",
"print(\"Precision: {:.2f}%\".format(100 * precision_score(y_test, y_pred)))\n",
"print(\"Recall: {:.2f}%\".format(100 * recall_score(y_test, y_pred)))"
"print(f\"Precision: {precision_score(y_test, y_pred):.2%}\")\n",
"print(f\"Recall: {recall_score(y_test, y_pred):.2%}\")"
]
},
{