Skip to content

Commit 2b1b5db

Browse files
Fix additional quirks
1 parent 5db3a65 commit 2b1b5db

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎Doc/library/collections.rst‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ by the :mod:`csv` or :mod:`sqlite3` modules::
949949
EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, paygrade')
950950

951951
import csv
952-
with open("employees.csv", newline="", encoding="utf-8") as f:
952+
with open("employees.csv", newline="") as f:
953953
for emp in map(EmployeeRecord._make, csv.reader(f)):
954954
print(emp.name, emp.title)
955955

@@ -959,6 +959,7 @@ by the :mod:`csv` or :mod:`sqlite3` modules::
959959
cursor.execute('SELECT name, age, title, department, paygrade FROM employees')
960960
for emp in map(EmployeeRecord._make, cursor.fetchall()):
961961
print(emp.name, emp.title)
962+
conn.close()
962963

963964
In addition to the methods inherited from tuples, named tuples support
964965
three additional methods and two attributes. To prevent conflicts with

0 commit comments

Comments
 (0)