8000 [po] auto sync · python/python-docs-zh-cn@435ff8c · GitHub
[go: up one dir, main page]

Skip to content

Commit 435ff8c

Browse files
[po] auto sync
1 parent 28f6301 commit 435ff8c

File tree

3 files changed

+108
-3
lines changed

3 files changed

+108
-3
lines changed

.stat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"translation": "80.95%", "updated_at": "2025-02-21T15:56:13Z"}
1+
{"translation": "80.97%", "updated_at": "2025-02-22T14:55:20Z"}

howto/urllib2.po

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# Dai Xu <daixu61@hotmail.com>, 2021
1313
# ProgramRipper, 2023
1414
# lian Wu (Wulian) <xiguawulian@gmail.com>, 2024
15-
# Freesand Leo <yuqinju@163.com>, 2024
15+
# Freesand Leo <yuqinju@163.com>, 2025
1616
#
1717
#, fuzzy
1818
msgid ""
@@ -21,7 +21,7 @@ msgstr ""
2121
"Report-Msgid-Bugs-To: \n"
2222
"POT-Creation-Date: 2025-02-21 14:16+0000\n"
2323
"PO-Revision-Date: 2021-06-28 00:53+0000\n"
24-
"Last-Translator: Freesand Leo <yuqinju@163.com>, 2024\n"
24+
"Last-Translator: Freesand Leo <yuqinju@163.com>, 2025\n"
2525
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
2626
"MIME-Version: 1.0\n"
2727
"Content-Type: text/plain; charset=UTF-8\n"
@@ -312,6 +312,18 @@ msgid ""
312312
">>> full_url = url + '?' + url_values\n"
313313
">>> data = urllib.request.urlopen(full_url)"
314314
msgstr ""
315+
">>> import urllib.request\n"
316+
">>> import urllib.parse\n"
317+
">>> data = {}\n"
318+
">>> data['name'] = 'Somebody Here'\n"
319+
">>> data['location'] = 'Northampton'\n"
320+
">>> data['language'] = 'Python'\n"
321+
">>> url_values = urllib.parse.urlencode(data)\n"
322+
">>> print(url_values) # The order may differ from below.\n"
323+
"name=Somebody+Here&language=Python&location=Northampton\n"
324+
">>> url = 'http://www.example.com/example.cgi'\n"
325+
">>> full_url = url + '?' + url_values\n"
326+
">>> data = urllib.request.urlopen(full_url)"
315327

316328
#: ../../howto/urllib2.rst:154
317329
msgid ""
@@ -441,6 +453,12 @@ msgid ""
441 8000 453
"...\n"
442454
"(4, 'getaddrinfo failed')"
443455
msgstr ""
456+
">>> req = urllib.request.Request('http://www.pretend_server.org')\n"
457+
">>> try: urllib.request.urlopen(req)\n"
458+
"... except urllib.error.URLError as e:\n"
459+
"... print(e.reason)\n"
460+
"...\n"
461+
"(4, 'getaddrinfo failed')"
444462

445463
#: ../../howto/urllib2.rst:225
446464
msgid "HTTPError"
@@ -662,6 +680,19 @@ msgid ""
662680
" <title>Page Not Found</title>\\n\n"
663681
" ..."
664682
msgstr ""
683+
">>> req = urllib.request.Request('http://www.python.org/fish.html')\n"
684+
">>> try:\n"
685+
"... urllib.request.urlopen(req)\n"
686+
"... except urllib.error.HTTPError as e:\n"
687+
"... print(e.code)\n"
688+
"... print(e.read())\n"
689+
"...\n"
690+
"404\n"
691+
"b'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"
692+
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\\n\\n\\n<html\n"
693+
" ...\n"
694+
" <title>Page Not Found</title>\\n\n"
695+
" ..."
665696

666697
#: ../../howto/urllib2.rst:339
667698
msgid "Wrapping it Up"

library/ctypes.po

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ msgid ""
325325
"0x1d000000\n"
326326
">>>"
327327
msgstr ""
328+
">>> print(hex(windll.kernel32.GetModuleHandleA(None)))\n"
329+
"0x1d000000\n"
330+
">>>"
328331

329332
#: ../../library/ctypes.rst:165
330333
msgid ""
@@ -347,6 +350,17 @@ msgid ""
347350
"ValueError: Procedure probably called with too many arguments (4 bytes in excess)\n"
348351
">>>"
349352
msgstr ""
353+
">>> cdll.kernel32.GetModuleHandleA(None)\n"
354+
"Traceback (most recent call last):\n"
355+
" File \"<stdin>\", line 1, in <module>\n"
356+
"ValueError: Procedure probably called with not enough arguments (4 bytes missing)\n"
357+
">>>\n"
358+
"\n"
359+
">>> windll.msvcrt.printf(b\"spam\")\n"
360+
"Traceback (most recent call last):\n"
361+
" File \"<stdin>\", line 1, in <module>\n"
362+
"ValueError: Procedure probably called with too many arguments (4 bytes in excess)\n"
363+
">>>"
350364

351365
#: ../../library/ctypes.rst:180
352366
msgid ""
@@ -369,6 +383,11 @@ msgid ""
369383
"OSError: exception: access violation reading 0x00000020\n"
370384
">>>"
371385
msgstr ""
386+
">>> windll.kernel32.GetModuleHandleA(32)\n"
387+
"Traceback (most recent call last):\n"
388+
" File \"<stdin>\", line 1, in <module>\n"
389+
"OSError: exception: access violation reading 0x00000020\n"
390+
">>>"
372391

373392
#: ../../library/ctypes.rst:193
374393
msgid ""
@@ -693,6 +712,9 @@ msgid ""
693712
" point to, *not the contents* of the memory block (of course not, because "
694713
"Python string objects are immutable)::"
695714
msgstr ""
715+
"给指针类型的实例Assigning a new value to instances of the pointer types "
716+
":class:`c_char_p`, :class:`c_wchar_p` 和 :class:`c_void_p` 赋新值会改变它们所指向的 "
717+
"*内存位置*,而不是内存块的 *内容* (当然不是,因为 Python 字符串对象是不可变的)::"
696718

697719
#: ../../library/ctypes.rst:297
698720
msgid ""
@@ -1059,6 +1081,8 @@ msgid ""
10591081
">>> print(libc.time(None))\n"
10601082
"1150640792"
10611083
msgstr ""
1084+
">>> print(libc.time(None))\n"
1085+
"1150640792"
10621086

10631087
#: ../../library/ctypes.rst:497
10641088
msgid ""
@@ -1078,6 +1102,15 @@ msgid ""
10781102
"None\n"
10791103
">>>"
10801104
msgstr ""
1105+
">>> strchr = libc.strchr\n"
1106+
">>> strchr(b\"abcdef\", ord(\"d\"))\n"
1107+
"8059983\n"
1108+
">>> strchr.restype = c_char_p # c_char_p 是一个指向字符串的指针\n"
1109+
">>> strchr(b\"abcdef\", ord(\"d\"))\n"
1110+
"b'def'\n"
1111+
">>> print(strchr(b\"abcdef\", ord(\"x\")))\n"
1112+
"None\n"
1113+
">>>"
10811114

10821115
#: ../../library/ctypes.rst:510
10831116
msgid ""
@@ -1147,6 +1180,22 @@ msgid ""
11471180
"OSError: [Errno 126] The specified module could not be found.\n"
11481181
">>>"
11491182
msgstr ""
1183+
">>> GetModuleHandle = windll.kernel32.GetModuleHandleA\n"
1184+
">>> def ValidHandle(value):\n"
1185+
"... if value == 0:\n"
1186+
"... raise WinError()\n"
1187+
"... return value\n"
1188+
"...\n"
1189+
">>>\n"
1190+
">>> GetModuleHandle.restype = ValidHandle\n"
1191+
">>> GetModuleHandle(None)\n"
1192+
"486539264\n"
1193+
">>> GetModuleHandle(\"something silly\")\n"
1194+
"Traceback (most recent call last):\n"
1195+
" File \"<stdin>\", line 1, in <module>\n"
1196+
" File \"<stdin>\", line 3, in ValidHandle\n"
1197+
"OSError: [Errno 126] The specified module could not be found.\n"
1198+
">>>"
11501199

11511200
#: ../../library/ctypes.rst:552
11521201
msgid ""
@@ -1380,6 +1429,12 @@ msgid ""
13801429
"specifying a :attr:`~Structure._align_` class attribute in the subclass "
13811430
"definition."
13821431
msgstr ""
1432+
"在默认情况下,Structure 和 Union 字段使用与 C 编译器一样的方式进行对齐。 可以通过在子类定义中指定 "
1433+
":attr:`~Structure._pack_` 类属性来覆盖此行为。 该属性必须被设为一个正整数来指明字段的最大对齐值。 这也是 ``#pragma"
1434+
" pack(n)`` 在 MSVC 中所做的事情。 还可以使用与. It is also possible to set a minimum "
1435+
"alignment for how the subclass itself is packed in the same way ``#pragma "
1436+
"align(n)`` 在 MSVC 中一样的方式来设置子类本身数据打包的最小对齐值。 这可以通过在子类定义中指定 "
1437+
":attr:`~Structure._align_` 类属性来实现。"
13831438

13841439
#: ../../library/ctypes.rst:677
13851440
msgid ""
@@ -2122,6 +2177,13 @@ msgid ""
21222177
"py_cmp_func 1 7\n"
21232178
">>>"
21242179
msgstr ""
2180+
">>> qsort(ia, len(ia), sizeof(c_int), cmp_func)\n"
2181+
"py_cmp_func 5 1\n"
2182+
"py_cmp_func 33 99\n"
2183+
"py_cmp_func 7 33\n"
2184+
"py_cmp_func 5 7\n"
2185+
"py_cmp_func 1 7\n"
2186+
">>>"
21252187

21262188
#: ../../library/ctypes.rst:1051
21272189
msgid "Now we can actually compare the two items and return a useful result::"
@@ -2142,6 +2204,18 @@ msgid ""
21422204
"py_cmp_func 5 7\n"
21432205
">>>"
21442206
msgstr ""
2207+
">>> def py_cmp_func(a, b):\n"
2208+
"... print(\"py_cmp_func\", a[0], b[0])\n"
2209+
"... return a[0] - b[0]\n"
2210+
"...\n"
2211+
">>>\n"
2212+
">>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func))\n"
2213+
"py_cmp_func 5 1\n"
2214+
"py_cmp_func 33 99\n"
2215+
"py_cmp_func 7 33\n"
2216+
"py_cmp_func 1 7\n"
2217+
"py_cmp_func 5 7\n"
2218+
">>>"
21452219

21462220
#: ../../library/ctypes.rst:1066
21472221
msgid "As we can easily check, our array is sorted now::"

0 commit comments

Comments
 (0)
0