@@ -342,98 +342,150 @@ msgid ""
342
342
"endings (``\\ n`` on Unix, ``\\ r\\ n`` on Windows) to just ``\\ n``. When "
343
343
"writing in text mode, the default is to convert occurrences of ``\\ n`` back "
344
344
"to platform-specific line endings. This behind-the-scenes modification to "
345
- "file data is fine for text files, but will corrupt binary data like that in : "
346
- "file:`JPEG` or :file:`EXE` files. Be very careful to use binary mode when "
345
+ "file data is fine for text files, but will corrupt binary data like that in "
346
+ ": file:`JPEG` or :file:`EXE` files. Be very careful to use binary mode when "
347
347
"reading and writing such files."
348
348
msgstr ""
349
+ "Cuando se lee en modo texto, por defecto se convierten los fines de lineas "
350
+ "que son específicos a las plataformas (``\\ n`` en Unix, ``\\ r\\ n`` en "
351
+ "Windows) a solamente ``\\ n``. Cuando se escribe en modo texto, por defecto "
352
+ "se convierten los ``\\ n`` a los finales de linea específicos de la "
353
+ "plataforma. Este cambio automático está bien para archivos de texto, pero "
354
+ "corrompería datos binarios como los de archivos :file:`JPEG` o :file:`EXE`."
355
+ " Asegurate de usar modo binario cuando leas y escribas tales archivos."
349
356
350
357
#: ../Doc/tutorial/inputoutput.rst:317
351
358
msgid ""
352
359
"It is good practice to use the :keyword:`with` keyword when dealing with "
353
360
"file objects. The advantage is that the file is properly closed after its "
354
- "suite finishes, even if an exception is raised at some point. Using : "
355
- "keyword:`!with` is also much shorter than writing equivalent :keyword:`try` "
356
- "\\ -\\ :keyword:`finally` blocks::"
361
+ "suite finishes, even if an exception is raised at some point. Using "
362
+ ": keyword:`!with` is also much shorter than writing equivalent "
363
+ ":keyword:`try` \\ -\\ :keyword:`finally` blocks::"
357
364
msgstr ""
365
+ "Es una buena práctica usar la declaración :keyword:`with` cuando manejamos "
366
+ "objetos archivo. Tiene la ventaja que el archivo es cerrado apropiadamente "
367
+ "luego de que el bloque termina, incluso si se generó una excepción. También"
368
+ " es mucho más corto que escribir los equivalentes bloques :keyword:`try`\\ "
369
+ "-\\ :keyword:`finally` ::"
358
370
359
371
#: ../Doc/tutorial/inputoutput.rst:328
360
372
msgid ""
361
- "If you're not using the :keyword:`with` keyword, then you should call ``f."
362
- "close()`` to close the file and immediately free up any system resources "
363
- "used by it. If you don't explicitly close a file, Python's garbage collector "
364
- "will eventually destroy the object and close the open file for you, but the "
365
- "file may stay open for a while. Another risk is that different Python "
366
- "implementations will do this clean-up at different times."
367
- msgstr ""
373
+ "If you're not using the :keyword:`with` keyword, then you should call "
374
+ "``f.close()`` to close the file and immediately free up any system resources"
375
+ " used by it. If you don't explicitly close a file, Python's garbage "
376
+ "collector will eventually destroy the object and close the open file for "
377
+ "you, but the file may stay open for a while. Another risk is that different"
378
+ " Python implementations will do this clean-up at different times."
379
+ msgstr ""
380
+ "Si no estuvieses usando el bloque :keyword:`with`, entonces deberías llamar "
381
+ "``f.close()`` para cerrar el archivo e inmediatamente liberar cualquier "
382
+ "recurso del sistema usado por este. Si no cierras explícitamente el archivo,"
383
+ " el «garbage collector» de Python eventualmente destruirá el objeto y "
384
+ "cerrará el archivo por vos, pero el archivo puede estar abierto por un "
385
+ "tiempo. Otro riesgo es que diferentes implementaciones de Python harán esta "
386
+ "limpieza en diferentes momentos."
368
387
369
388
#: ../Doc/tutorial/inputoutput.rst:336
370
389
msgid ""
371
390
"After a file object is closed, either by a :keyword:`with` statement or by "
372
391
"calling ``f.close()``, attempts to use the file object will automatically "
373
392
"fail. ::"
374
393
msgstr ""
394
+ "Después de que un objeto de archivo es cerrado, ya sea por :keyword:`with` o"
395
+ " llamando a ``f.close()``, intentar volver a utilizarlo fallará "
396
+ "automáticamente::"
375
397
376
398
#: ../Doc/tutorial/inputoutput.rst:350
377
399
msgid "Methods of File Objects"
378
- msgstr ""
400
+ msgstr "Métodos de los objetos Archivo "
379
401
380
402
#: ../Doc/tutorial/inputoutput.rst:352
381
403
msgid ""
382
404
"The rest of the examples in this section will assume that a file object "
383
405
"called ``f`` has already been created."
384
406
msgstr ""
407
+ "El resto de los ejemplos en esta sección asumirán que ya se creó un objeto "
408
+ "archivo llamado ``f``."
385
409
386
410
#: ../Doc/tutorial/inputoutput.rst:355
387
411
msgid ""
388
412
"To read a file's contents, call ``f.read(size)``, which reads some quantity "
389
- "of data and returns it as a string (in text mode) or bytes object (in binary "
390
- "mode). *size* is an optional numeric argument. When *size* is omitted or "
413
+ "of data and returns it as a string (in text mode) or bytes object (in binary"
414
+ " mode). *size* is an optional numeric argument. When *size* is omitted or "
391
415
"negative, the entire contents of the file will be read and returned; it's "
392
416
"your problem if the file is twice as large as your machine's memory. "
393
417
"Otherwise, at most *size* bytes are read and returned. If the end of the "
394
- "file has been reached, ``f.read()`` will return an empty string (``''``). ::"
395
- msgstr ""
418
+ "file has been reached, ``f.read()`` will return an empty string (``''``). "
419
+ "::"
420
+ msgstr ""
421
+ "Para leer el contenido de una archivo llamá a ``f.read(cantidad)``, el cual "
422
+ "lee alguna cantidad de datos y los devuelve como una cadena de (en modo "
423
+ "texto) o un objeto de bytes (en modo binario). *cantidad* es un argumento "
424
+ "numérico opcional. Cuando se omite *cantidad* o es negativo, el contenido "
425
+ "entero del archivo será leido y devuelto; es tu problema si el archivo es el"
426
+ " doble de grande que la memoria de tu máquina. De otra manera, a lo sumo "
427
+ "una *cantidad* de bytes son leídos y devueltos. Si se alcanzó el fin del "
428
+ "archivo, ``f.read()`` devolverá una cadena vacía (``\"\" ``). ::"
396
429
397
430
#: ../Doc/tutorial/inputoutput.rst:369
398
431
msgid ""
399
- "``f.readline()`` reads a single line from the file; a newline character (`` "
400
- "\\ n``) is left at the end of the string, and is only omitted on the last "
432
+ "``f.readline()`` reads a single line from the file; a newline character "
433
+ "(`` \\ n``) is left at the end of the string, and is only omitted on the last "
401
434
"line of the file if the file doesn't end in a newline. This makes the "
402
435
"return value unambiguous; if ``f.readline()`` returns an empty string, the "
403
436
"end of the file has been reached, while a blank line is represented by "
404
437
"``'\\ n'``, a string containing only a single newline. ::"
405
438
msgstr ""
439
+ "``f.readline()`` lee una sola linea del archivo; el caracter de fin de linea"
440
+ " (``\\ n``) se deja al final de la cadena, y sólo se omite en la última linea"
441
+ " del archivo si el mismo no termina en un fin de linea. Esto hace que el "
442
+ "valor de retorno no sea ambiguo; si ``f.readline()`` devuelve una cadena "
443
+ "vacía, es que se alcanzó el fin del archivo, mientras que una linea en "
444
+ "blanco es representada por ``'\\ n'``, una cadena conteniendo sólo un único "
445
+ "fin de linea. ::"
406
446
407
447
#: ../Doc/tutorial/inputoutput.rst:383
408
448
msgid ""
409
449
"For reading lines from a file, you can loop over the file object. This is "
410
450
"memory efficient, fast, and leads to simple code::"
411
451
msgstr ""
452
+ "Para leer líneas de un archivo, podés iterar sobre el objeto archivo. Esto "
453
+ "es eficiente en memoria, rápido, y conduce a un código más simple::"
412
454
413
455
#: ../Doc/tutorial/inputoutput.rst:392
414
456
msgid ""
415
457
"If you want to read all the lines of a file in a list you can also use "
416
458
"``list(f)`` or ``f.readlines()``."
417
459
msgstr ""
460
+ "Si querés leer todas las líneas de un archivo en una lista también podés "
461
+ "usar ``list(f)`` o ``f.readlines()``."
418
462
419
463
#: ../Doc/tutorial/inputoutput.rst:395
420
464
msgid ""
421
465
"``f.write(string)`` writes the contents of *string* to the file, returning "
422
466
"the number of characters written. ::"
423
467
msgstr ""
468
+ "``f.write(cadena)`` escribe el contenido de la *cadena* al archivo, "
469
+ "devolviendo la cantidad de caracteres escritos. ::"
424
470
425
471
#: ../Doc/tutorial/inputoutput.rst:401
426
472
msgid ""
427
473
"Other types of objects need to be converted -- either to a string (in text "
428
474
"mode) or a bytes object (in binary mode) -- before writing them::"
429
475
msgstr ""
476
+ "Otros tipos de objetos necesitan serconvertidos -- tanto a una cadena (en "
477
+ "modo texto) o a un objeto de bytes (en modo binario) -- antes de "
478
+ "escribirlos::"
430
479
431
480
#: ../Doc/tutorial/inputoutput.rst:409
432
481
msgid ""
433
- "``f.tell()`` returns an integer giving the file object's current position in "
434
- "the file represented as number of bytes from the beginning of the file when "
435
- "in binary mode and an opaque number when in text mode."
482
+ "``f.tell()`` returns an integer giving the file object's current position in"
483
+ " the file represented as number of bytes from the beginning of the file when"
484
+ " in binary mode and an opaque number when in text mode."
436
485
msgstr ""
486
+ "``f.tell()`` devuelve un entero que indica la posición actual en el archivo "
487
+ "representada como número de bytes desde el comienzo del archivo en modo "
488
+ "binario y un número opaco en modo texto."
437
489
438
490
#: ../Doc/tutorial/inputoutput.rst:413
439
491
msgid ""
@@ -445,26 +497,42 @@ msgid ""
445
497
"*from_what* can be omitted and defaults to 0, using the beginning of the "
446
498
"file as the reference point. ::"
447
499
msgstr ""
500
+ "Para cambiar la posición del objeto archivo, usá ``f.seek(desplazamiento, "
501
+ "desde_donde)``. La posición es calculada agregando el *desplazamiento* a un"
502
+ " punto de referencia; el punto de referencia se selecciona del argumento "
503
+ "*desde_donde*. Un valor *desde_donde* de 0 mide desde el comienzo del "
504
+ "archivo, 1 usa la posición actual del archivo, y 2 usa el fin del archivo "
505
+ "como punto de referencia. *desde_donde* puede omitirse, el default es 0, "
506
+ "usando el comienzo del archivo como punto de referencia. ::"
448
507
449
508
#: ../Doc/tutorial/inputoutput.rst:432
450
509
msgid ""
451
510
"In text files (those opened without a ``b`` in the mode string), only seeks "
452
511
"relative to the beginning of the file are allowed (the exception being "
453
512
"seeking to the very file end with ``seek(0, 2)``) and the only valid "
454
- "*offset* values are those returned from the ``f.tell()``, or zero. Any other "
455
- "*offset* value produces undefined behaviour."
513
+ "*offset* values are those returned from the ``f.tell()``, or zero. Any other"
514
+ " *offset* value produces undefined behaviour."
456
515
msgstr ""
516
+ "En los archivos de texto (aquellos que se abrieron sin una ``b`` en el "
517
+ "modo), se permiten solamente desplazamientos con ``seek`` relativos al "
518
+ "comienzo (con la excepción de ir justo al final con ``seek(0, 2)``) y los "
519
+ "únicos valores de *desplazamiento* válidos son aquellos retornados por "
520
+ "``f.tell()``, o cero. Cualquier otro valor de *desplazamiento* produce un "
521
+ "comportamiento indefinido."
457
522
458
523
#: ../Doc/tutorial/inputoutput.rst:438
459
524
msgid ""
460
- "File objects have some additional methods, such as :meth:`~file.isatty` and : "
461
- "meth:`~file.truncate` which are less frequently used; consult the Library "
525
+ "File objects have some additional methods, such as :meth:`~file.isatty` and "
526
+ ": meth:`~file.truncate` which are less frequently used; consult the Library "
462
527
"Reference for a complete guide to file objects."
463
528
msgstr ""
529
+ "Los objetos archivo tienen algunos métodos más, como :meth:`isatty` y "
530
+ ":meth:`truncate` que son usados menos frecuentemente; consultá la Referencia"
531
+ " de la Biblioteca para una guía completa sobre los objetos archivo."
464
532
465
533
#: ../Doc/tutorial/inputoutput.rst:446
466
534
msgid "Saving structured data with :mod:`json`"
467
- msgstr ""
535
+ msgstr "Guardar datos estructurados con :mod:`json` "
468
536
469
537
#: ../Doc/tutorial/inputoutput.rst:450
470
538
msgid ""
@@ -475,19 +543,36 @@ msgid ""
475
543
"complex data types like nested lists and dictionaries, parsing and "
476
544
"serializing by hand becomes complicated."
477
545
msgstr ""
546
+ "Las cadenas pueden facilmente escribirse y leerse de un archivo. Los "
547
+ "números toman algo más de esfuerzo, ya que el método :meth:`read` sólo "
548
+ "devuelve cadenas, que tendrán que ser pasadas a una función como "
549
+ ":func:`int`, que toma una cadena como ``'123'`` y devuelve su valor numérico"
550
+ " 123. Sin embargo, cuando querés grabar tipos de datos más complejos como "
551
+ "listas, diccionarios, o instancias de clases, las cosas se ponen más "
552
+ "complicadas."
478
553
479
554
#: ../Doc/tutorial/inputoutput.rst:457
480
555
msgid ""
481
556
"Rather than having users constantly writing and debugging code to save "
482
557
"complicated data types to files, Python allows you to use the popular data "
483
- "interchange format called `JSON (JavaScript Object Notation) <http://json. "
484
- "org>`_. The standard module called :mod:`json` can take Python data "
485
- "hierarchies, and convert them to string representations; this process is "
486
- "called :dfn:`serializing`. Reconstructing the data from the string "
558
+ "interchange format called `JSON (JavaScript Object Notation) "
559
+ "<http://json. org>`_. The standard module called :mod:`json` can take Python"
560
+ " data hierarchies, and convert them to string representations; this process "
561
+ "is called :dfn:`serializing`. Reconstructing the data from the string "
487
562
"representation is called :dfn:`deserializing`. Between serializing and "
488
563
"deserializing, the string representing the object may have been stored in a "
489
564
"file or data, or sent over a network connection to some distant machine."
490
565
msgstr ""
566
+ "En lugar de tener a los usuarios constantemente escribiendo y debugueando "
567
+ "código para grabar tipos de datos complicados, Python te permite usar "
568
+ "formato intercambiable de datos popular llamado `JSON (JavaScript Object "
569
+ "Notation) <http://json.org>`_. El módulo estandar llamado :mod:`json` puede "
570
+ "tomar datos de Python con una jerarquía, y convertirlo a representaciones de"
571
+ " cadena de caracteres; este proceso es llamado :dfn:`serializing`. "
572
+ "Reconstruir los datos desde la representación de cadena de caracteres es "
573
+ "llamado :dfn:`deserializing`. Entre serialización y deserialización, la "
574
+ "cadena de caracteres representando el objeto quizás haya sido guardado en un"
575
+ " archivo o datos, o enviado a una máquina distante por una conexión de red."
491
576
492
577
#: ../Doc/tutorial/inputoutput.rst:468
493
578
msgid ""
@@ -501,19 +586,27 @@ msgid ""
501
586
"If you have an object ``x``, you can view its JSON string representation "
502
587
"with a simple line of code::"
503
588
msgstr ""
589
+ "Si tienes un objeto ``x``, puedes ver su representación JSON con una simple "
590
+ "línea de código::"
504
591
505
592
#: ../Doc/tutorial/inputoutput.rst:479
506
593
msgid ""
507
- "Another variant of the :func:`~json.dumps` function, called :func:`~json. "
508
- "dump`, simply serializes the object to a :term:`text file`. So if ``f`` is "
509
- "a :term:`text file` object opened for writing, we can do this::"
594
+ "Another variant of the :func:`~json.dumps` function, called "
595
+ ":func:`~json. dump`, simply serializes the object to a :term:`text file`. So"
596
+ " if ``f`` is a :term:`text file` object opened for writing, we can do this::"
510
597
msgstr ""
598
+ "Otra variante de la función :func:`~json.dumps`, llamada :func:`~json.dump`,"
599
+ " simplemente serializa el objeto a un :term:`archivo de texto`. Así que, si "
600
+ "``f`` es un objeto :term:`archivo de texto` abierto para escritura, podemos "
601
+ "hacer::"
511
602
512
603
#: ../Doc/tutorial/inputoutput.rst:485
513
604
msgid ""
514
- "To decode the object again, if ``f`` is a :term:`text file` object which has "
515
- "been opened for reading::"
605
+ "To decode the object again, if ``f`` is a :term:`text file` object which has"
606
+ " been opened for reading::"
516
607
msgstr ""
608
+ "Para decodificar un objeto nuevamente, si ``f`` es un objeto :term:`archivo "
609
+ "de texto` que fue abierto para lectura::"
517
610
518
611
#: ../Doc/tutorial/inputoutput.rst:490
519
612
msgid ""
@@ -522,6 +615,10 @@ msgid ""
522
615
"effort. The reference for the :mod:`json` module contains an explanation of "
523
616
"this."
524
617
msgstr ""
618
+ "La simple técnica de serialización puede manejar listas y diccionarios, pero"
619
+ " serializar instancias de clases arbitrarias en JSON requiere un poco de "
620
+ "esfuerzo extra. La referencia del módulo :mod:`json` contiene una "
621
+ "explicación de esto."
525
622
526
623
#: ../Doc/tutorial/inputoutput.rst:496
527
624
msgid ":mod:`pickle` - the pickle module"
0 commit comments