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
4bb186d7
Unverified
Kaydet (Commit)
4bb186d7
authored
Kas 25, 2018
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Kas 25, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-32035: Fix words about strings and bytes in zipfile documentation. (GH-10592)
üst
7f4ba4af
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
16 deletions
+12
-16
zipfile.rst
Doc/library/zipfile.rst
+10
-14
zipfile.py
Lib/zipfile.py
+2
-2
No files found.
Doc/library/zipfile.rst
Dosyayı görüntüle @
4bb186d7
...
...
@@ -387,13 +387,6 @@ ZipFile Objects
given.
The archive must be open with mode ``'w'``, ``'x'`` or ``'a'``.
.. note::
There is no official file name encoding for ZIP files. If you have unicode file
names, you must convert them to byte strings in your desired encoding before
passing them to :meth:`write`. WinZip interprets all file names as encoded in
CP437, also known as DOS Latin.
.. note::
Archive names should be relative to the archive root, that is, they should not
...
...
@@ -413,7 +406,9 @@ ZipFile Objects
.. method:: ZipFile.writestr(zinfo_or_arcname, data, compress_type=None, \
compresslevel=None)
Write the string *data* to the archive; *zinfo_or_arcname* is either the file
Write a file into the archive. The contents is *data*, which may be either
a :class:`str` or a :class:`bytes` instance; if it is a :class:`str`,
it is encoded as UTF-8 first. *zinfo_or_arcname* is either the file
name it will be given in the archive, or a :class:`ZipInfo` instance. If it's
an instance, at least the filename, date, and time must be given. If it's a
name, the date and time is set to the current date and time.
...
...
@@ -454,11 +449,11 @@ The following data attributes are also available:
.. attribute:: ZipFile.comment
The comment text associated with the ZIP file. If assigning a comment to a
The comment associated with the ZIP file as a :class:`bytes` object.
If assigning a comment to a
:class:`ZipFile` instance created with mode ``'w'``, ``'x'`` or ``'a'``,
this should be a
string no longer than 65535 bytes. Comments longer than this will be
truncated in the written archive when :meth:`close` is called.
it should be no longer than 65535 bytes. Comments longer than this will be
truncated.
.. _pyzipfile-objects:
...
...
@@ -625,13 +620,14 @@ Instances have the following methods and attributes:
.. attribute:: ZipInfo.comment
Comment for the individual archive member.
Comment for the individual archive member
as a :class:`bytes` object
.
.. attribute:: ZipInfo.extra
Expansion field data. The `PKZIP Application Note`_ contains
some comments on the internal structure of the data contained in this string.
some comments on the internal structure of the data contained in this
:class:`bytes` object.
.. attribute:: ZipInfo.create_system
...
...
Lib/zipfile.py
Dosyayı görüntüle @
4bb186d7
...
...
@@ -402,7 +402,7 @@ class ZipInfo (object):
return
''
.
join
(
result
)
def
FileHeader
(
self
,
zip64
=
None
):
"""Return the per-file header as a
string
."""
"""Return the per-file header as a
bytes object
."""
dt
=
self
.
date_time
dosdate
=
(
dt
[
0
]
-
1980
)
<<
9
|
dt
[
1
]
<<
5
|
dt
[
2
]
dostime
=
dt
[
3
]
<<
11
|
dt
[
4
]
<<
5
|
(
dt
[
5
]
//
2
)
...
...
@@ -1429,7 +1429,7 @@ class ZipFile:
self
.
_didModify
=
True
def
read
(
self
,
name
,
pwd
=
None
):
"""Return file bytes
(as a string)
for name."""
"""Return file bytes for name."""
with
self
.
open
(
name
,
"r"
,
pwd
)
as
fp
:
return
fp
.
read
()
...
...
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