From e2aee301781d8351e467475376bfc5c33aa2b8e3 Mon Sep 17 00:00:00 2001 From: Matheus Felipe <50463866+matheusfelipeog@users.noreply.github.com> Date: Sun, 6 Feb 2022 18:01:33 -0300 Subject: [PATCH] Fixes in With line number Fixes: - Change the variable name from "input" to "file". "input" is built-in function, this action overrides it. - Fix space between "i" variable and "line" variable in for loop --- python.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python.md b/python.md index cd1faef..8ab16bb 100644 --- a/python.md +++ b/python.md @@ -983,8 +983,8 @@ with open("myfile.txt") as file: ``` #### With line number ```python -input = open('myfile.txt', 'r') -for i,line in enumerate(input, start=1): +file = open('myfile.txt', 'r') +for i, line in enumerate(file, start=1): print("Number %s: %s" % (i, line)) ```