From c4280cc354d59fee75f232ce527d119e99231d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Geron?= Date: Mon, 22 Nov 2021 10:17:46 +1300 Subject: [PATCH] Replace .format with f-strings --- 03_classification.ipynb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/03_classification.ipynb b/03_classification.ipynb index f2dfa63..4a91f34 100644 --- a/03_classification.ipynb +++ b/03_classification.ipynb @@ -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%}\")" ] }, {