@@ -204,8 +204,8 @@ msgstr ""
204204">>> print(hellos)\n"
205205"'witaj, świecie\\ n'\n"
206206">>> # argumentem repr() może być dowolny obiekt Pythona:\n"
207- ">>> repr((x, y, ('szynka ', 'jajka')))\n"
208- "\" (32.5, 40000, ('szynka ', 'jajka'))\" "
207+ ">>> repr((x, y, ('mielonka ', 'jajka')))\n"
208+ "\" (32.5, 40000, ('mielonka ', 'jajka'))\" "
209209
210210msgid ""
211211"The :mod:`string` module contains a :class:`~string.Template` class that "
@@ -345,10 +345,10 @@ msgid ""
345345">>> print('{1} and {0}'.format('spam', 'eggs'))\n"
346346"eggs and spam"
347347msgstr ""
348- ">>> print('{0} i {1}'.format('szynka ', 'jajka'))\n"
349- "szynka i jajka\n"
350- ">>> print('{1} i {0}'.format('szynka ', 'jajka'))\n"
351- "jajka i szynka "
348+ ">>> print('{0} i {1}'.format('mielonka ', 'jajka'))\n"
349+ "mielonka i jajka\n"
350+ ">>> print('{1} i {0}'.format('mielonka ', 'jajka'))\n"
351+ "jajka i mielonka "
352352
353353msgid ""
354354"If keyword arguments are used in the :meth:`str.format` method, their values "
@@ -374,6 +374,9 @@ msgid ""
374374"... other='Georg'))\n"
375375"The story of Bill, Manfred, and Georg."
376376msgstr ""
377+ ">>> print('Historia {0}, {1} i {other}.'.format('Billa', 'Manfreda',\n"
378+ "... other='Georga'))\n"
379+ "Historia of Billa, Manfreda i Georga."
377380
378381msgid ""
379382"If you have a really long format string that you don't want to split up, it "
@@ -429,6 +432,10 @@ msgid ""
429432">>> print(message.format(**table))\n"
430433"__name__: __main__; __doc__: None; __package__: None; __loader__: ..."
431434msgstr ""
435+ ">>> table = {k: str(v) for k, v in vars().items()}\n"
436+ ">>> message = \" \" .join([f'{k}: ' + '{' + k +'};' for k in table.keys()])\n"
437+ ">>> print(message.format(**table))\n"
438+ "__name__: __main__; __doc__: None; __package__: None; __loader__: ..."
432439
433440msgid ""
434441"As an example, the following lines produce a tidily aligned set of columns "
@@ -452,6 +459,19 @@ msgid ""
452459" 9 81 729\n"
453460"10 100 1000"
454461msgstr ""
462+ ">>> for x in range(1, 11):\n"
463+ "... print('{0:2d} {1:3d} {2:4d}'.format(x, x*x, x*x*x))\n"
464+ "...\n"
465+ " 1 1 1\n"
466+ " 2 4 8\n"
467+ " 3 9 27\n"
468+ " 4 16 64\n"
469+ " 5 25 125\n"
470+ " 6 36 216\n"
471+ " 7 49 343\n"
472+ " 8 64 512\n"
473+ " 9 81 729\n"
474+ "10 100 1000"
455475
456476msgid ""
457477"For a complete overview of string formatting with :meth:`str.format`, see :"
@@ -483,6 +503,21 @@ msgid ""
483503" 9 81 729\n"
484504"10 100 1000"
485505msgstr ""
506+ ">>> for x in range(1, 11):\n"
507+ "... print(repr(x).rjust(2), repr(x*x).rjust(3), end=' ')\n"
508+ "... # zwróć uwagę na użycie 'end' w poprzedniej linii\n"
509+ "... print(repr(x*x*x).rjust(4))\n"
510+ "...\n"
511+ " 1 1 1\n"
512+ " 2 4 8\n"
513+ " 3 9 27\n"
514+ " 4 16 64\n"
515+ " 5 25 125\n"
516+ " 6 36 216\n"
517+ " 7 49 343\n"
518+ " 8 64 512\n"
519+ " 9 81 729\n"
520+ "10 100 1000"
486521
487522msgid ""
488523"(Note that the one space between each column was added by the way :func:"
@@ -555,6 +590,9 @@ msgid ""
555590">>> print('The value of pi is approximately %5.3f.' % math.pi)\n"
556591"The value of pi is approximately 3.142."
557592msgstr ""
593+ ">>> import math\n"
594+ ">>> print('Wartość pi to około %5.3f.' % math.pi)\n"
595+ "Wartość pi to około 3.142."
558596
559597msgid ""
560598"More information can be found in the :ref:`old-string-formatting` section."
@@ -573,7 +611,7 @@ msgstr ""
573611"``open(filename, mode, encoding=None)``"
574612
575613msgid ">>> f = open('workfile', 'w', encoding=\" utf-8\" )"
576- msgstr ""
614+ msgstr ">>> f = open('plikroboczy', 'w', encoding= \" utf-8 \" ) "
577615
578616msgid ""
579617"The first argument is a string containing the filename. The second argument "
@@ -653,6 +691,12 @@ msgid ""
653691">>> f.closed\n"
654692"True"
655693msgstr ""
694+ ">>> with open('plikroboczy', encoding=\" utf-8\" ) as f:\n"
695+ "... read_data = f.read()\n"
696+ "\n"
697+ ">>> # Możemy sprawdzić, że plik został automatycznie zamknięty.\n"
698+ ">>> f.closed\n"
699+ "True"
656700
657701msgid ""
658702"If you're not using the :keyword:`with` keyword, then you should call ``f."
@@ -688,6 +732,11 @@ msgid ""
688732" File \" <stdin>\" , line 1, in <module>\n"
689733"ValueError: I/O operation on closed file."
690734msgstr ""
735+ ">>> f.close()\n"
736+ ">>> f.read()\n"
737+ "Traceback (most recent call last):\n"
738+ " File \" <stdin>\" , line 1, in <module>\n"
739+ "ValueError: I/O operation on closed file."
691740
692741msgid "Methods of File Objects"
693742msgstr "Metody obiektów plików"
@@ -725,6 +774,10 @@ msgid ""
725774">>> f.read()\n"
726775"''"
727776msgstr ""
777+ ">>> f.read()\n"
778+ "'To jest cały plik.\\ n'\n"
779+ ">>> f.read()\n"
780+ "''"
728781
729782msgid ""
730783"``f.readline()`` reads a single line from the file; a newline character "
@@ -750,6 +803,12 @@ msgid ""
750803">>> f.readline()\n"
751804"''"
752805msgstr ""
806+ ">>> f.readline()\n"
807+ "'To jest pierwsza linia pliku.\\ n'\n"
808+ ">>> f.readline()\n"
809+ "'Druga linia pliku\\ n'\n"
810+ ">>> f.readline()\n"
811+ "''"
753812
754813msgid ""
755814"For reading lines from a file, you can loop over the file object. This is "
@@ -765,6 +824,11 @@ msgid ""
765824"This is the first line of the file.\n"
766825"Second line of the file"
767826msgstr ""
827+ ">>> for line in f:\n"
828+ "... print(line, end='')\n"
829+ "...\n"
830+ "To jest pierwsza linia pliku.\n"
831+ "Druga linia pliku"
768832
769833msgid ""
770834"If you want to read all the lines of a file in a list you can also use "
@@ -784,6 +848,8 @@ msgid ""
784848">>> f.write('This is a test\\ n')\n"
785849"15"
786850msgstr ""
851+ ">>> f.write('To jest test\\ n')\n"
852+ "13"
787853
788854msgid ""
789855"Other types of objects need to be converted -- either to a string (in text "
@@ -799,6 +865,10 @@ msgid ""
799865">>> f.write(s)\n"
800866"18"
801867msgstr ""
868+ ">>> value = ('odpowiedź', 42)\n"
869+ ">>> s = str(value) # konwersja krotki na ciąg znaków\n"
870+ ">>> f.write(s)\n"
871+ "17"
802872
803873msgid ""
804874"``f.tell()`` returns an integer giving the file object's current position in "
@@ -838,6 +908,17 @@ msgid ""
838908">>> f.read(1)\n"
839909"b'd'"
840910msgstr ""
911+ ">>> f = open('plikroboczy', 'rb+')\n"
912+ ">>> f.write(b'0123456789abcdef')\n"
913+ "16\n"
914+ ">>> f.seek(5) # Idź do szóstego bajtu w pliku\n"
915+ "5\n"
916+ ">>> f.read(1)\n"
917+ "b'5'\n"
918+ ">>> f.seek(-3, 2) # Idź do trzeciego bajtu przed końcem\n"
919+ "13\n"
920+ ">>> f.read(1)\n"
921+ "b'd'"
841922
842923msgid ""
843924"In text files (those opened without a ``b`` in the mode string), only seeks "
@@ -924,6 +1005,10 @@ msgid ""
9241005">>> json.dumps(x)\n"
9251006"'[1, \" simple\" , \" list\" ]'"
9261007msgstr ""
1008+ ">>> import json\n"
1009+ ">>> x = [1, 'prosta', 'lista']\n"
1010+ ">>> json.dumps(x)\n"
1011+ "'[1, \" prosta\" , \" lista\" ]'"
9271012
9281013msgid ""
9291014"Another variant of the :func:`~json.dumps` function, called :func:`~json."
@@ -936,7 +1021,7 @@ msgstr ""
9361021"zapisu, możemy zrobić tak::"
9371022
9381023msgid "json.dump(x, f)"
939- msgstr ""
1024+ msgstr "json.dump(x, f) "
9401025
9411026msgid ""
9421027"To decode the object again, if ``f`` is a :term:`binary file` or :term:`text "
@@ -947,7 +1032,7 @@ msgstr ""
9471032"został otwarty do odczytu::"
9481033
9491034msgid "x = json.load(f)"
950- msgstr ""
1035+ msgstr "x = json.load(f) "
9511036
9521037msgid ""
9531038"JSON files must be encoded in UTF-8. Use ``encoding=\" utf-8\" `` when opening "
0 commit comments