From e84c0ff6337d48e06f727389fe9c428774ee78b7 Mon Sep 17 00:00:00 2001 From: fly6516 Date: Sun, 20 Apr 2025 02:29:25 +0800 Subject: [PATCH] =?UTF-8?q?style(4-1):=20=E6=9B=BF=E6=8D=A2=20f-string=20?= =?UTF-8?q?=E4=B8=BA=20format=20=E6=96=B9=E6=B3=95-=20=E5=B0=86=20f-string?= =?UTF-8?q?=20=E6=9B=BF=E6=8D=A2=E4=B8=BA=20str.format=20=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E4=BB=A5=E9=80=82=E5=BA=94=20Python=203.6=20?= =?UTF-8?q?=E4=BB=A5=E4=B8=8B=E7=89=88=E6=9C=AC-=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BA=86=E4=B8=89=E5=A4=84=20print=20=E8=AF=AD=E5=8F=A5?= =?UTF-8?q?=E5=92=8C=E4=B8=80=E5=A4=84=E5=8F=98=E9=87=8F=E8=B5=8B=E5=80=BC?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8=20str.format=20=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E6=9B=BF=E4=BB=A3=20f-string?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 4-1.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/4-1.py b/4-1.py index c3e1221..bf5cd2e 100644 --- a/4-1.py +++ b/4-1.py @@ -114,13 +114,13 @@ def parse_goldfile_line(goldfile_line): GOLDFILE_PATTERN = '^(.+),(.+)' match = re.search(GOLDFILE_PATTERN, goldfile_line) if match is None: - print(f'Invalid goldfile line: {goldfile_line}') + print('Invalid goldfile line: {0}'.format(goldfile_line)) return (goldfile_line, -1) elif match.group(1) == '"idAmazon"': - print(f'Header datafile line: {goldfile_line}') + print('Header datafile line: {0}'.format(goldfile_line)) return (goldfile_line, 0) else: - key = f'{match.group(1)} {match.group(2)}' + key = '{0} {1}'.format(match.group(1), match.group(2)) return ((key, 'gold'), 1) # 9. 使用广播变量提高效率