556 continue
557 SERVERS = self.get_servers(sessid, s)
558 log(
559 "[EUserv] {} {}{} {}{}".format(560 log_lang_options.get(log_lang, lambda x: x)(
561 "The @@@ account is detected"
562 ).replace("@@@", ordinal(i + 1)),
288 )
289
290 log(
291 "[Captcha Solver] {}{}".format(292 log_lang_options.get(log_lang, lambda x: x)(
293 "Failed to find parsed results"
294 ),
260 right_part = text[operator_pos + 1 :]
261 return (
262 eval(
263 "{left} {operator} {right}".format(264 left=left_part, operator=operator, right=right_part
265 )
266 )
274 )
275
276 log(
277 "[Captcha Solver] {}{}".format(278 log_lang_options.get(log_lang, lambda x: x)(
279 "Service Exception"
280 ),
532 mailparser_dl_url_id = check_item.get("mailparser_dl_url_id")
533 log("*" * 12)
534 log(
535 "[EUserv] {}{}".format(536 log_lang_options.get(log_lang, lambda x: x)(
537 "Renewing the @@@ account"
538 ).replace("@@@", ordinal(i + 1)),
f-strings are the fastest way to format strings as compared to the following methods:
%
format()
str.join
+
operator to concatinate stringTemplate.substitute
Some less preferred ways to format strings are the following:
from string import Template
menu = ('eggs', 'spam', 42.4)
old_order = "%s and %s: %.2f ¤" % menu # [consider-using-f-string]
beginner_order = menu[0] + " and " + menu[1] + ": " + str(menu[2]) + " ¤"
joined_order = " and ".join(menu[:2])
format_order = "{} and {}: {:0.2f} ¤".format(menu[0], menu[1], menu[2])
named_format_order = "{eggs} and {spam}: {price:0.2f} ¤".format(eggs=menu[0], spam=menu[1], price=menu[2])
template_order = Template('$eggs and $spam: $price ¤').substitute(eggs=menu[0], spam=menu[1], price=menu[2])
Consider using f-strings as shown below:
menu = ('eggs', 'spam', 42.4)
f_string_order = f"{menu[0]} and {menu[1]}: {menu[2]:0.2f} ¤"