@@ -342,98 +342,150 @@ msgid ""
342342"endings (``\\ n`` on Unix, ``\\ r\\ n`` on Windows) to just ``\\ n``. When "
343343"writing in text mode, the default is to convert occurrences of ``\\ n`` back "
344344"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 "
347347"reading and writing such files."
348348msgstr ""
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."
349356
350357#: ../Doc/tutorial/inputoutput.rst:317
351358msgid ""
352359"It is good practice to use the :keyword:`with` keyword when dealing with "
353360"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::"
357364msgstr ""
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` ::"
358370
359371#: ../Doc/tutorial/inputoutput.rst:328
360372msgid ""
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."
368387
369388#: ../Doc/tutorial/inputoutput.rst:336
370389msgid ""
371390"After a file object is closed, either by a :keyword:`with` statement or by "
372391"calling ``f.close()``, attempts to use the file object will automatically "
373392"fail. ::"
374393msgstr ""
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::"
375397
376398#: ../Doc/tutorial/inputoutput.rst:350
377399msgid "Methods of File Objects"
378- msgstr ""
400+ msgstr "Métodos de los objetos Archivo "
379401
380402#: ../Doc/tutorial/inputoutput.rst:352
381403msgid ""
382404"The rest of the examples in this section will assume that a file object "
383405"called ``f`` has already been created."
384406msgstr ""
407+ "El resto de los ejemplos en esta sección asumirán que ya se creó un objeto "
408+ "archivo llamado ``f``."
385409
386410#: ../Doc/tutorial/inputoutput.rst:355
387411msgid ""
388412"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 "
391415"negative, the entire contents of the file will be read and returned; it's "
392416"your problem if the file is twice as large as your machine's memory. "
393417"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 (``\"\" ``). ::"
396429
397430#: ../Doc/tutorial/inputoutput.rst:369
398431msgid ""
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 "
401434"line of the file if the file doesn't end in a newline. This makes the "
402435"return value unambiguous; if ``f.readline()`` returns an empty string, the "
403436"end of the file has been reached, while a blank line is represented by "
404437"``'\\ n'``, a string containing only a single newline. ::"
405438msgstr ""
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. ::"
406446
407447#: ../Doc/tutorial/inputoutput.rst:383
408448msgid ""
409449"For reading lines from a file, you can loop over the file object. This is "
410450"memory efficient, fast, and leads to simple code::"
411451msgstr ""
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::"
412454
413455#: ../Doc/tutorial/inputoutput.rst:392
414456msgid ""
415457"If you want to read all the lines of a file in a list you can also use "
416458"``list(f)`` or ``f.readlines()``."
417459msgstr ""
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()``."
418462
419463#: ../Doc/tutorial/inputoutput.rst:395
420464msgid ""
421465"``f.write(string)`` writes the contents of *string* to the file, returning "
422466"the number of characters written. ::"
423467msgstr ""
468+ "``f.write(cadena)`` escribe el contenido de la *cadena* al archivo, "
469+ "devolviendo la cantidad de caracteres escritos. ::"
424470
425471#: ../Doc/tutorial/inputoutput.rst:401
426472msgid ""
427473"Other types of objects need to be converted -- either to a string (in text "
428474"mode) or a bytes object (in binary mode) -- before writing them::"
429475msgstr ""
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::"
430479
431480#: ../Doc/tutorial/inputoutput.rst:409
432481msgid ""
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."
436485msgstr ""
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."
437489
438490#: ../Doc/tutorial/inputoutput.rst:413
439491msgid ""
@@ -445,26 +497,42 @@ msgid ""
445497"*from_what* can be omitted and defaults to 0, using the beginning of the "
446498"file as the reference point. ::"
447499msgstr ""
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. ::"
448507
449508#: ../Doc/tutorial/inputoutput.rst:432
450509msgid ""
451510"In text files (those opened without a ``b`` in the mode string), only seeks "
452511"relative to the beginning of the file are allowed (the exception being "
453512"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."
456515msgstr ""
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."
457522
458523#: ../Doc/tutorial/inputoutput.rst:438
459524msgid ""
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 "
462527"Reference for a complete guide to file objects."
463528msgstr ""
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."
464532
465533#: ../Doc/tutorial/inputoutput.rst:446
466534msgid "Saving structured data with :mod:`json`"
467- msgstr ""
535+ msgstr "Guardar datos estructurados con :mod:`json` "
468536
469537#: ../Doc/tutorial/inputoutput.rst:450
470538msgid ""
@@ -475,19 +543,36 @@ msgid ""
475543"complex data types like nested lists and dictionaries, parsing and "
476544"serializing by hand becomes complicated."
477545msgstr ""
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."
478553
479554#: ../Doc/tutorial/inputoutput.rst:457
480555msgid ""
481556"Rather than having users constantly writing and debugging code to save "
482557"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 "
487562"representation is called :dfn:`deserializing`. Between serializing and "
488563"deserializing, the string representing the object may have been stored in a "
489564"file or data, or sent over a network connection to some distant machine."
490565msgstr ""
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."
491576
492577#: ../Doc/tutorial/inputoutput.rst:468
493578msgid ""
@@ -501,19 +586,27 @@ msgid ""
501586"If you have an object ``x``, you can view its JSON string representation "
502587"with a simple line of code::"
503588msgstr ""
589+ "Si tienes un objeto ``x``, puedes ver su representación JSON con una simple "
590+ "línea de código::"
504591
505592#: ../Doc/tutorial/inputoutput.rst:479
506593msgid ""
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::"
510597msgstr ""
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::"
511602
512603#: ../Doc/tutorial/inputoutput.rst:485
513604msgid ""
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::"
516607msgstr ""
608+ "Para decodificar un objeto nuevamente, si ``f`` es un objeto :term:`archivo "
609+ "de texto` que fue abierto para lectura::"
517610
518611#: ../Doc/tutorial/inputoutput.rst:490
519612msgid ""
@@ -522,6 +615,10 @@ msgid ""
522615"effort. The reference for the :mod:`json` module contains an explanation of "
523616"this."
524617msgstr ""
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."
525622
526623#: ../Doc/tutorial/inputoutput.rst:496
527624msgid ":mod:`pickle` - the pickle module"
0 commit comments