Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
3f7a9482
Kaydet (Commit)
3f7a9482
authored
Eyl 06, 2003
tarafından
Skip Montanaro
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
**kwds arg was missing from __init__ for Dict{Reader,Writer} classes.
will backport.
üst
60e868ab
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
+14
-4
csv.py
Lib/csv.py
+4
-4
test_csv.py
Lib/test/test_csv.py
+7
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/csv.py
Dosyayı görüntüle @
3f7a9482
...
...
@@ -93,11 +93,11 @@ register_dialect("excel-tab", excel_tab)
class
DictReader
:
def
__init__
(
self
,
f
,
fieldnames
,
restkey
=
None
,
restval
=
None
,
dialect
=
"excel"
,
*
args
):
dialect
=
"excel"
,
*
args
,
**
kwds
):
self
.
fieldnames
=
fieldnames
# list of keys for the dict
self
.
restkey
=
restkey
# key to catch long rows
self
.
restval
=
restval
# default value for short rows
self
.
reader
=
reader
(
f
,
dialect
,
*
args
)
self
.
reader
=
reader
(
f
,
dialect
,
*
args
,
**
kwds
)
def
__iter__
(
self
):
return
self
...
...
@@ -122,7 +122,7 @@ class DictReader:
class
DictWriter
:
def
__init__
(
self
,
f
,
fieldnames
,
restval
=
""
,
extrasaction
=
"raise"
,
dialect
=
"excel"
,
*
args
):
dialect
=
"excel"
,
*
args
,
**
kwds
):
self
.
fieldnames
=
fieldnames
# list of keys for the dict
self
.
restval
=
restval
# for writing short dicts
if
extrasaction
.
lower
()
not
in
(
"raise"
,
"ignore"
):
...
...
@@ -130,7 +130,7 @@ class DictWriter:
(
"extrasaction (
%
s) must be 'raise' or 'ignore'"
%
extrasaction
)
self
.
extrasaction
=
extrasaction
self
.
writer
=
writer
(
f
,
dialect
,
*
args
)
self
.
writer
=
writer
(
f
,
dialect
,
*
args
,
**
kwds
)
def
_dict_to_list
(
self
,
rowdict
):
if
self
.
extrasaction
==
"raise"
:
...
...
Lib/test/test_csv.py
Dosyayı görüntüle @
3f7a9482
...
...
@@ -447,6 +447,13 @@ class TestDictFields(unittest.TestCase):
self
.
assertEqual
(
reader
.
next
(),
{
"1"
:
'1'
,
"2"
:
'2'
,
"3"
:
'abc'
,
"4"
:
'4'
,
"5"
:
'5'
,
"6"
:
'6'
})
def
test_read_semi_sep
(
self
):
reader
=
csv
.
DictReader
([
"1;2;abc;4;5;6
\r\n
"
],
fieldnames
=
"1 2 3 4 5 6"
.
split
(),
delimiter
=
';'
)
self
.
assertEqual
(
reader
.
next
(),
{
"1"
:
'1'
,
"2"
:
'2'
,
"3"
:
'abc'
,
"4"
:
'4'
,
"5"
:
'5'
,
"6"
:
'6'
})
class
TestArrayWrites
(
unittest
.
TestCase
):
def
test_int_write
(
self
):
import
array
...
...
Misc/NEWS
Dosyayı görüntüle @
3f7a9482
...
...
@@ -33,6 +33,9 @@ Extension modules
Library
-------
-
The
csv
module
's DictReader and DictWriter classes now accept keyword
arguments. This was an omission in the initial implementation.
- The email package handles some RFC 2231 parameters with missing
CHARSET fields better. It also includes a patch to parameter
parsing when semicolons appear inside quotes.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment