9
9
msgstr ""
10
10
"Project-Id-Version : Python 3.10\n "
11
11
"Report-Msgid-Bugs-To : \n "
12
- "POT-Creation-Date : 2022-05-21 17:35 +0000\n "
12
+ "POT-Creation-Date : 2022-06-10 00:16 +0000\n "
13
13
"PO-Revision-Date : 2018-05-23 14:35+0000\n "
14
14
"Last-Translator : Adrian Liaw <adrianliaw2000@gmail.com>\n "
15
15
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -519,53 +519,58 @@ msgstr ""
519
519
520
520
#: ../../faq/library.rst:486
521
521
msgid ""
522
- "The :mod:`shutil` module contains a :func:`~shutil.copyfile` function. Note "
523
- "that on MacOS 9 it doesn't copy the resource fork and Finder info."
522
+ "The :mod:`shutil` module contains a :func:`~shutil.copyfile` function. Note "
523
+ "that on Windows NTFS volumes, it does not copy `alternate data streams "
524
+ "<https://en.wikipedia.org/wiki/NTFS#Alternate_data_stream_(ADS)>`_ nor "
525
+ "`resource forks <https://en.wikipedia.org/wiki/Resource_fork>`__ on macOS HFS"
526
+ "+ volumes, though both are now rarely used. It also doesn't copy file "
527
+ "permissions and metadata, though using :func:`shutil.copy2` instead will "
528
+ "preserve most (though not all) of it."
524
529
msgstr ""
525
530
526
- #: ../../faq/library.rst:491
531
+ #: ../../faq/library.rst:497
527
532
msgid "How do I read (or write) binary data?"
528
533
msgstr ""
529
534
530
- #: ../../faq/library.rst:493
535
+ #: ../../faq/library.rst:499
531
536
msgid ""
532
537
"To read or write complex binary data formats, it's best to use the :mod:"
533
538
"`struct` module. It allows you to take a string containing binary data "
534
539
"(usually numbers) and convert it to Python objects; and vice versa."
535
540
msgstr ""
536
541
537
- #: ../../faq/library.rst:497
542
+ #: ../../faq/library.rst:503
538
543
msgid ""
539
544
"For example, the following code reads two 2-byte integers and one 4-byte "
540
545
"integer in big-endian format from a file::"
541
546
msgstr ""
542
547
543
- #: ../../faq/library.rst:506
548
+ #: ../../faq/library.rst:512
544
549
msgid ""
545
550
"The '>' in the format string forces big-endian data; the letter 'h' reads "
546
551
"one \" short integer\" (2 bytes), and 'l' reads one \" long integer\" (4 "
547
552
"bytes) from the string."
548
553
msgstr ""
549
554
550
- #: ../../faq/library.rst:510
555
+ #: ../../faq/library.rst:516
551
556
msgid ""
552
557
"For data that is more regular (e.g. a homogeneous list of ints or floats), "
553
558
"you can also use the :mod:`array` module."
554
559
msgstr ""
555
560
556
- #: ../../faq/library.rst:515
561
+ #: ../../faq/library.rst:521
557
562
msgid ""
558
563
"To read and write binary data, it is mandatory to open the file in binary "
559
564
"mode (here, passing ``\" rb\" `` to :func:`open`). If you use ``\" r\" `` "
560
565
"instead (the default), the file will be open in text mode and ``f.read()`` "
561
566
"will return :class:`str` objects rather than :class:`bytes` objects."
562
567
msgstr ""
563
568
564
- #: ../../faq/library.rst:523
569
+ #: ../../faq/library.rst:529
565
570
msgid "I can't seem to use os.read() on a pipe created with os.popen(); why?"
566
571
msgstr ""
567
572
568
- #: ../../faq/library.rst:525
573
+ #: ../../faq/library.rst:531
569
574
msgid ""
570
575
":func:`os.read` is a low-level function which takes a file descriptor, a "
571
576
"small integer representing the opened file. :func:`os.popen` creates a high-"
@@ -574,37 +579,37 @@ msgid ""
574
579
"popen`, you need to use ``p.read(n)``."
575
580
msgstr ""
576
581
577
- #: ../../faq/library.rst:612
582
+ #: ../../faq/library.rst:618
578
583
msgid "How do I access the serial (RS232) port?"
579
584
msgstr ""
580
585
581
- #: ../../faq/library.rst:614
586
+ #: ../../faq/library.rst:620
582
587
msgid "For Win32, OSX, Linux, BSD, Jython, IronPython:"
583
588
msgstr ""
584
589
585
- #: ../../faq/library.rst:616
590
+ #: ../../faq/library.rst:622
586
591
msgid "https://pypi.org/project/pyserial/"
587
592
msgstr "https://pypi.org/project/pyserial/"
588
593
589
- #: ../../faq/library.rst:618
594
+ #: ../../faq/library.rst:624
590
595
msgid "For Unix, see a Usenet post by Mitch Chapman:"
591
596
msgstr ""
592
597
593
- #: ../../faq/library.rst:620
598
+ #: ../../faq/library.rst:626
594
599
msgid "https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com"
595
600
msgstr "https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com"
596
601
597
- #: ../../faq/library.rst:624
602
+ #: ../../faq/library.rst:630
598
603
msgid "Why doesn't closing sys.stdout (stdin, stderr) really close it?"
599
604
msgstr ""
600
605
601
- #: ../../faq/library.rst:626
606
+ #: ../../faq/library.rst:632
602
607
msgid ""
603
608
"Python :term:`file objects <file object>` are a high-level layer of "
604
609
"abstraction on low-level C file descriptors."
605
610
msgstr ""
606
611
607
- #: ../../faq/library.rst:629
612
+ #: ../../faq/library.rst:635
608
613
msgid ""
609
614
"For most file objects you create in Python via the built-in :func:`open` "
610
615
"function, ``f.close()`` marks the Python file object as being closed from "
@@ -613,120 +618,120 @@ msgid ""
613
618
"``f`` becomes garbage."
614
619
msgstr ""
615
620
616
- #: ../../faq/library.rst:635
621
+ #: ../../faq/library.rst:641
617
622
msgid ""
618
623
"But stdin, stdout and stderr are treated specially by Python, because of the "
619
624
"special status also given to them by C. Running ``sys.stdout.close()`` "
620
625
"marks the Python-level file object as being closed, but does *not* close the "
621
626
"associated C file descriptor."
622
627
msgstr ""
623
628
624
- #: ../../faq/library.rst:640
629
+ #: ../../faq/library.rst:646
625
630
msgid ""
626
631
"To close the underlying C file descriptor for one of these three, you should "
627
632
"first be sure that's what you really want to do (e.g., you may confuse "
628
633
"extension modules trying to do I/O). If it is, use :func:`os.close`::"
629
634
msgstr ""
630
635
631
- #: ../../faq/library.rst:648
636
+ #: ../../faq/library.rst:654
632
637
msgid "Or you can use the numeric constants 0, 1 and 2, respectively."
633
638
msgstr ""
634
639
635
- #: ../../faq/library.rst:652
640
+ #: ../../faq/library.rst:658
636
641
msgid "Network/Internet Programming"
637
642
msgstr ""
638
643
639
- #: ../../faq/library.rst:655
644
+ #: ../../faq/library.rst:661
640
645
msgid "What WWW tools are there for Python?"
641
646
msgstr ""
642
647
643
- #: ../../faq/library.rst:657
648
+ #: ../../faq/library.rst:663
644
649
msgid ""
645
650
"See the chapters titled :ref:`internet` and :ref:`netdata` in the Library "
646
651
"Reference Manual. Python has many modules that will help you build server-"
647
652
"side and client-side web systems."
648
653
msgstr ""
649
654
650
- #: ../../faq/library.rst:663
655
+ #: ../../faq/library.rst:669
651
656
msgid ""
652
657
"A summary of available frameworks is maintained by Paul Boddie at https://"
653
658
"wiki.python.org/moin/WebProgramming\\ ."
654
659
msgstr ""
655
660
656
- #: ../../faq/library.rst:666
661
+ #: ../../faq/library.rst:672
657
662
msgid ""
658
663
"Cameron Laird maintains a useful set of pages about Python web technologies "
659
664
"at http://phaseit.net/claird/comp.lang.python/web_python."
660
665
msgstr ""
661
666
662
- #: ../../faq/library.rst:671
667
+ #: ../../faq/library.rst:677
663
668
msgid "How can I mimic CGI form submission (METHOD=POST)?"
664
669
msgstr ""
665
670
666
- #: ../../faq/library.rst:673
671
+ #: ../../faq/library.rst:679
667
672
msgid ""
668
673
"I would like to retrieve web pages that are the result of POSTing a form. Is "
669
674
"there existing code that would let me do this easily?"
670
675
msgstr ""
671
676
672
- #: ../../faq/library.rst:676
677
+ #: ../../faq/library.rst:682
673
678
msgid "Yes. Here's a simple example that uses :mod:`urllib.request`::"
674
679
msgstr ""
675
680
676
- #: ../../faq/library.rst:691
681
+ #: ../../faq/library.rst:697
677
682
msgid ""
678
683
"Note that in general for percent-encoded POST operations, query strings must "
679
684
"be quoted using :func:`urllib.parse.urlencode`. For example, to send "
680
685
"``name=Guy Steele, Jr.``::"
681
686
msgstr ""
682
687
683
- #: ../../faq/library.rst:699
688
+ #: ../../faq/library.rst:705
684
689
msgid ":ref:`urllib-howto` for extensive examples."
685
690
msgstr ""
686
691
687
- #: ../../faq/library.rst:703
692
+ #: ../../faq/library.rst:709
688
693
msgid "What module should I use to help with generating HTML?"
689
694
msgstr ""
690
695
691
- #: ../../faq/library.rst:707
696
+ #: ../../faq/library.rst:713
692
697
msgid ""
693
698
"You can find a collection of useful links on the `Web Programming wiki page "
694
699
"<https://wiki.python.org/moin/WebProgramming>`_."
695
700
msgstr ""
696
701
697
- #: ../../faq/library.rst:712
702
+ #: ../../faq/library.rst:718
698
703
msgid "How do I send mail from a Python script?"
699
704
msgstr ""
700
705
701
- #: ../../faq/library.rst:714
706
+ #: ../../faq/library.rst:720
702
707
msgid "Use the standard library module :mod:`smtplib`."
703
708
msgstr ""
704
709
705
- #: ../../faq/library.rst:716
710
+ #: ../../faq/library.rst:722
706
711
msgid ""
707
712
"Here's a very simple interactive mail sender that uses it. This method will "
708
713
"work on any host that supports an SMTP listener. ::"
709
714
msgstr ""
710
715
711
- #: ../../faq/library.rst:736
716
+ #: ../../faq/library.rst:742
712
717
msgid ""
713
718
"A Unix-only alternative uses sendmail. The location of the sendmail program "
714
719
"varies between systems; sometimes it is ``/usr/lib/sendmail``, sometimes ``/"
715
720
"usr/sbin/sendmail``. The sendmail manual page will help you out. Here's "
716
721
"some sample code::"
717
722
msgstr ""
718
723
719
- #: ../../faq/library.rst:756
724
+ #: ../../faq/library.rst:762
720
725
msgid "How do I avoid blocking in the connect() method of a socket?"
721
726
msgstr ""
722
727
723
- #: ../../faq/library.rst:758
728
+ #: ../../faq/library.rst:764
724
729
msgid ""
725
730
"The :mod:`select` module is commonly used to help with asynchronous I/O on "
726
731
"sockets."
727
732
msgstr ""
728
733
729
- #: ../../faq/library.rst:761
734
+ #: ../../faq/library.rst:767
730
735
msgid ""
731
736
"To prevent the TCP connect from blocking, you can set the socket to non-"
732
737
"blocking mode. Then when you do the :meth:`socket.connect`, you will either "
@@ -736,7 +741,7 @@ msgid ""
736
741
"values, so you're going to have to check what's returned on your system."
737
742
msgstr ""
738
743
739
- #: ../../faq/library.rst:768
744
+ #: ../../faq/library.rst:774
740
745
msgid ""
741
746
"You can use the :meth:`socket.connect_ex` method to avoid creating an "
742
747
"exception. It will just return the errno value. To poll, you can call :"
@@ -745,102 +750,102 @@ msgid ""
745
750
"select` to check if it's writable."
746
751
msgstr ""
747
752
748
- #: ../../faq/library.rst:774
753
+ #: ../../faq/library.rst:780
749
754
msgid ""
750
755
"The :mod:`asyncio` module provides a general purpose single-threaded and "
751
756
"concurrent asynchronous library, which can be used for writing non-blocking "
752
757
"network code. The third-party `Twisted <https://twistedmatrix.com/trac/>`_ "
753
758
"library is a popular and feature-rich alternative."
754
759
msgstr ""
755
760
756
- #: ../../faq/library.rst:782
761
+ #: ../../faq/library.rst:788
757
762
msgid "Databases"
758
763
msgstr ""
759
764
760
- #: ../../faq/library.rst:785
765
+ #: ../../faq/library.rst:791
761
766
msgid "Are there any interfaces to database packages in Python?"
762
767
msgstr ""
763
768
764
- #: ../../faq/library.rst:787
769
+ #: ../../faq/library.rst:793
765
770
msgid "Yes."
766
771
msgstr "有的"
767
772
768
- #: ../../faq/library.rst:789
773
+ #: ../../faq/library.rst:795
769
774
msgid ""
770
775
"Interfaces to disk-based hashes such as :mod:`DBM <dbm.ndbm>` and :mod:`GDBM "
771
776
"<dbm.gnu>` are also included with standard Python. There is also the :mod:"
772
777
"`sqlite3` module, which provides a lightweight disk-based relational "
773
778
"database."
774
779
msgstr ""
775
780
776
- #: ../../faq/library.rst:794
781
+ #: ../../faq/library.rst:800
777
782
msgid ""
778
783
"Support for most relational databases is available. See the "
779
784
"`DatabaseProgramming wiki page <https://wiki.python.org/moin/"
780
785
"DatabaseProgramming>`_ for details."
781
786
msgstr ""
782
787
783
- #: ../../faq/library.rst:800
788
+ #: ../../faq/library.rst:806
784
789
msgid "How do you implement persistent objects in Python?"
785
790
msgstr ""
786
791
787
- #: ../../faq/library.rst:802
792
+ #: ../../faq/library.rst:808
788
793
msgid ""
789
794
"The :mod:`pickle` library module solves this in a very general way (though "
790
795
"you still can't store things like open files, sockets or windows), and the :"
791
796
"mod:`shelve` library module uses pickle and (g)dbm to create persistent "
792
797
"mappings containing arbitrary Python objects."
793
798
msgstr ""
794
799
795
- #: ../../faq/library.rst:809
800
+ #: ../../faq/library.rst:815
796
801
msgid "Mathematics and Numerics"
797
802
msgstr ""
798
803
799
- #: ../../faq/library.rst:812
804
+ #: ../../faq/library.rst:818
800
805
msgid "How do I generate random numbers in Python?"
801
806
msgstr ""
802
807
803
- #: ../../faq/library.rst:814
808
+ #: ../../faq/library.rst:820
804
809
msgid ""
805
810
"The standard module :mod:`random` implements a random number generator. "
806
811
"Usage is simple::"
807
812
msgstr ""
808
813
809
- #: ../../faq/library.rst:820
814
+ #: ../../faq/library.rst:826
810
815
msgid "This returns a random floating point number in the range [0, 1)."
811
816
msgstr ""
812
817
813
- #: ../../faq/library.rst:822
818
+ #: ../../faq/library.rst:828
814
819
msgid ""
815
820
"There are also many other specialized generators in this module, such as:"
816
821
msgstr ""
817
822
818
- #: ../../faq/library.rst:824
823
+ #: ../../faq/library.rst:830
819
824
msgid "``randrange(a, b)`` chooses an integer in the range [a, b)."
820
825
msgstr ""
821
826
822
- #: ../../faq/library.rst:825
827
+ #: ../../faq/library.rst:831
823
828
msgid "``uniform(a, b)`` chooses a floating point number in the range [a, b)."
824
829
msgstr ""
825
830
826
- #: ../../faq/library.rst:826
831
+ #: ../../faq/library.rst:832
827
832
msgid ""
828
833
"``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution."
829
834
msgstr ""
830
835
831
- #: ../../faq/library.rst:828
836
+ #: ../../faq/library.rst:834
832
837
msgid "Some higher-level functions operate on sequences directly, such as:"
833
838
msgstr ""
834
839
835
- #: ../../faq/library.rst:830
840
+ #: ../../faq/library.rst:836
836
841
msgid "``choice(S)`` chooses a random element from a given sequence."
837
842
msgstr ""
838
843
839
- #: ../../faq/library.rst:831
844
+ #: ../../faq/library.rst:837
840
845
msgid "``shuffle(L)`` shuffles a list in-place, i.e. permutes it randomly."
841
846
msgstr ""
842
847
843
- #: ../../faq/library.rst:833
848
+ #: ../../faq/library.rst:839
844
849
msgid ""
845
850
"There's also a ``Random`` class you can instantiate to create independent "
846
851
"multiple random number generators."
0 commit comments