# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # # Translators: # Alireza Shabani (Revisto) , 2025 # Danial Behzadi , 2025 # Rafael Fontenelle , 2025 # Sepehr Rasouli , 2026 # arman mohebali , 2026 # msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-10-01 14:41+0330\n" "PO-Revision-Date: 2026-10-06 20:43+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/python/python-docs-fa/)\n" "Language: fa\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Poedit 3.6\n" msgid ":mod:`!csv` --- CSV file reading and writing" msgstr ":mod:`!csv` --- خواندن و نوشتن پرونده‌های CSV" msgid "**Source code:** :source:`Lib/csv.py`" msgstr "**کد منبع:** :source:`Lib/csv.py`" msgid "The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases. CSV format was used for many years prior to attempts to describe the format in a standardized way in :rfc:`4180`. The lack of a well-defined standard means that subtle differences often exist in the data produced and consumed by different applications. These differences can make it annoying to process CSV files from multiple sources. Still, while the delimiters and quoting characters vary, the overall format is similar enough that it is possible to write a single module which can efficiently manipulate such data, hiding the details of reading and writing the data from the programmer." msgstr "قالب به‌اصطلاح CSV (مقادیر جداشده با ویرگول) رایج‌ترین قالب ایمپورت و اکسپورت برای صفحات گسترده و پایگاه‌های داده است. قالب CSV سال‌ها پیش از تلاش‌ها برای توصیف این قالب به‌صورت استانداردشده در :rfc:`4180` استفاده می‌شد. فقدان یک استاندارد خوش‌تعریف به این معناست که اغلب تفاوت‌های ظریفی در داده‌های تولیدشده و مصرف‌شده توسط برنامه‌های کاربردی مختلف وجود دارد. این تفاوت‌ها می‌توانند پردازش پرونده‌های CSV از منابع متعدد را آزاردهنده سازند. با این حال، با وجود اینکه جداکننده‌ها و نویسه‌های نقل‌قول متفاوت‌اند، قالب کلی به‌اندازه‌ای مشابه است که می‌توان یک ماژول واحد نوشت که چنین داده‌هایی را به‌طور کارآمد دست‌کاری کند و جزئیات خواندن و نوشتن داده‌ها را از برنامه‌نویس پنهان کند." msgid "The :mod:`!csv` module implements classes to read and write tabular data in CSV format. It allows programmers to say, \"write this data in the format preferred by Excel,\" or \"read data from this file which was generated by Excel,\" without knowing the precise details of the CSV format used by Excel. Programmers can also describe the CSV formats understood by other applications or define their own special-purpose CSV formats." msgstr "ماژول :mod:`!csv` کلاس‌هایی را برای خواندن و نوشتن داده‌های جدولی در قالب CSV پیاده‌سازی می‌کند. این ماژول به برنامه‌نویسان اجازه می‌دهد بگویند: «این داده‌ها را در قالب مورد نظر Excel بنویس» یا «داده‌ها را از این پرونده که توسط Excel تولید شده است بخوان»، بدون آنکه جزئیات دقیق قالب CSV مورد استفاده Excel را بدانند. برنامه‌نویسان همچنین می‌توانند قالب‌های CSV قابل‌فهم برای سایر برنامه‌ها را توصیف کنند یا قالب‌های CSV خاص‌منظور خود را تعریف کنند." msgid "The :mod:`!csv` module's :class:`reader` and :class:`writer` objects read and write sequences. Programmers can also read and write data in dictionary form using the :class:`DictReader` and :class:`DictWriter` classes." msgstr "اشیای :class:`reader` و :class:`writer` ماژول :mod:`!csv` دنباله‌ها را می‌خوانند و می‌نویسند. برنامه‌نویسان همچنین می‌توانند داده‌ها را در قالب دیکشنری با استفاده از کلاس‌های :class:`DictReader` و :class:`DictWriter` بخوانند و بنویسند." msgid ":pep:`305` - CSV File API" msgstr ":pep:`305` - API پرونده‌ی CSV" msgid "The Python Enhancement Proposal which proposed this addition to Python." msgstr "پیشنهاد بهبود پایتون (Python Enhancement Proposal) که این افزوده را برای پایتون پیشنهاد داد." msgid "Module contents" msgstr "محتویات ماژول" msgid "The :mod:`!csv` module defines the following functions:" msgstr "ماژول :mod:`!csv` توابع زیر را تعریف می‌کند:" msgid "Return a :ref:`reader object ` that will process lines from the given *csvfile*. A csvfile must be an iterable of strings, each in the reader's defined csv format. A csvfile is most commonly a file-like object or list. If *csvfile* is a file object, it should be opened with ``newline=''``. [1]_ An optional *dialect* parameter can be given which is used to define a set of parameters specific to a particular CSV dialect. It may be an instance of a subclass of the :class:`Dialect` class or one of the strings returned by the :func:`list_dialects` function. The other optional *fmtparams* keyword arguments can be given to override individual formatting parameters in the current dialect. For full details about the dialect and formatting parameters, see section :ref:`csv-fmt-params`." msgstr "یک :ref:`شیء خواننده ` برمی‌گرداند که سطرهای *csvfile* داده‌شده را پردازش می‌کند. یک csvfile باید یک پیمایش‌پذیر از رشته‌ها باشد، که هرکدام در قالب csv تعریف‌شده‌ی خواننده قرار دارند. csvfile معمولاً یک شیء شبه‌پرونده یا فهرست است. اگر *csvfile* یک شیء پرونده باشد، باید با ``newline=''`` باز شود. [1]_ می‌توان یک پارامتر اختیاری *dialect* را ارائه کرد که برای تعریف مجموعه‌ای از پارامترهای مختص یک گویش CSV خاص استفاده می‌شود. این پارامتر ممکن است نمونه‌ای از یک زیرکلاس از کلاس :class:`Dialect` یا یکی از رشته‌های برگردانده‌شده توسط تابع :func:`list_dialects` باشد. می‌توان سایر آرگومان‌های کلیدواژه‌ای اختیاری *fmtparams* را برای بازنویسی پارامترهای قالب‌بندی جداگانه در گویش فعلی ارائه کرد. برای جزئیات کامل درباره گویش و پارامترهای قالب‌بندی، بخش :ref:`csv-fmt-params` را ببینید." msgid "Each row read from the csv file is returned as a list of strings. No automatic data type conversion is performed unless the :data:`QUOTE_NONNUMERIC` format option is specified (in which case unquoted fields are transformed into floats)." msgstr "هر ردیف خوانده‌شده از پرونده csv به‌صورت فهرستی از رشته‌ها برگردانده می‌شود. هیچ تبدیل خودکار نوع داده‌ای انجام نمی‌شود، مگر اینکه گزینه قالب :data:`QUOTE_NONNUMERIC` مشخص شده باشد (در این صورت فیلدهای بدون علامت نقل‌قول به float تبدیل می‌شوند)." msgid "A short usage example::" msgstr "یک مثال کوتاه از کاربرد::" msgid "" ">>> import csv\n" ">>> with open('eggs.csv', newline='') as csvfile:\n" "... spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')\n" "... for row in spamreader:\n" "... print(', '.join(row))\n" "Spam, Spam, Spam, Spam, Spam, Baked Beans\n" "Spam, Lovely Spam, Wonderful Spam" msgstr "" ">>> import csv\n" ">>> with open('eggs.csv', newline='') as csvfile:\n" "... spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')\n" "... for row in spamreader:\n" "... print(', '.join(row))\n" "Spam, Spam, Spam, Spam, Spam, Baked Beans\n" "Spam, Lovely Spam, Wonderful Spam" msgid "where :file:`eggs.csv` contains:" msgstr "که :file:`eggs.csv` شامل:" msgid "" "Spam Spam Spam Spam Spam |Baked Beans|\n" "Spam |Lovely Spam| |Wonderful Spam|" msgstr "" "Spam Spam Spam Spam Spam |Baked Beans|\n" "Spam |Lovely Spam| |Wonderful Spam|" msgid "Return a writer object responsible for converting the user's data into delimited strings on the given file-like object. *csvfile* can be any object with a :meth:`~io.TextIOBase.write` method. If *csvfile* is a file object, it should be opened with ``newline=''`` [1]_. An optional *dialect* parameter can be given which is used to define a set of parameters specific to a particular CSV dialect. It may be an instance of a subclass of the :class:`Dialect` class or one of the strings returned by the :func:`list_dialects` function. The other optional *fmtparams* keyword arguments can be given to override individual formatting parameters in the current dialect. For full details about dialects and formatting parameters, see the :ref:`csv-fmt-params` section. To make it as easy as possible to interface with modules which implement the DB API, the value :const:`None` is written as the empty string. While this isn't a reversible transformation, it makes it easier to dump SQL NULL data values to CSV files without preprocessing the data returned from a ``cursor.fetch*`` call. All other non-string data are stringified with :func:`str` before being written." msgstr "یک شیء نویسنده را برمی‌گرداند که مسئول تبدیل داده‌های کاربر به رشته‌های جداشده روی شیء شبه‌پرونده داده‌شده است. *csvfile* می‌تواند هر شیءای با متد :meth:`~io.TextIOBase.write` باشد. اگر *csvfile* یک شیء پرونده است، باید با ``newline=''`` باز شود [1]_. می‌توان یک پارامتر اختیاری *dialect* را داد که برای تعریف مجموعه‌ای از پارامترهای مختص یک گویش CSV معین استفاده می‌شود. این ممکن است نمونه‌ای از زیرکلاسی از کلاس :class:`Dialect` یا یکی از رشته‌های برگردانده‌شده توسط تابع :func:`list_dialects` باشد. می‌توان سایر آرگومان‌های کلیدواژه‌ای اختیاری *fmtparams* را برای لغو پارامترهای قالب‌بندی منفرد در گویش فعلی داد. برای جزئیات کامل درباره گویش‌ها و پارامترهای قالب‌بندی، بخش :ref:`csv-fmt-params` را ببینید. برای اینکه تا حد امکان برقراری رابط با ماژول‌هایی که DB API را پیاده‌سازی می‌کنند آسان شود، مقدار :const:`None` به‌صورت رشته خالی نوشته می‌شود. هرچند این تبدیل بازگشت‌پذیر نیست، اما نوشتن مقادیر داده‌ی SQL NULL در پرونده‌های CSV بدون پیش‌پردازش داده‌های برگردانده‌شده از فراخوانی ``cursor.fetch*`` را آسان‌تر می‌کند. تمام داده‌های غیررشته‌ای دیگر پیش از نوشته شدن با :func:`str` به رشته تبدیل می‌شوند." msgid "" "import csv\n" "with open('eggs.csv', 'w', newline='') as csvfile:\n" " spamwriter = csv.writer(csvfile, delimiter=' ',\n" " quotechar='|', quoting=csv.QUOTE_MINIMAL)\n" " spamwriter.writerow(['Spam'] * 5 + ['Baked Beans'])\n" " spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])" msgstr "" "import csv\n" "with open('eggs.csv', 'w', newline='') as csvfile:\n" " spamwriter = csv.writer(csvfile, delimiter=' ',\n" " quotechar='|', quoting=csv.QUOTE_MINIMAL)\n" " spamwriter.writerow(['Spam'] * 5 + ['Baked Beans'])\n" " spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])" msgid "which writes :file:`eggs.csv` containing:" msgstr "که :file:`eggs.csv` را می‌نویسد، شامل:" msgid "Associate *dialect* with *name*. *name* must be a string. The dialect can be specified either by passing a sub-class of :class:`Dialect`, or by *fmtparams* keyword arguments, or both, with keyword arguments overriding parameters of the dialect. For full details about dialects and formatting parameters, see section :ref:`csv-fmt-params`." msgstr "*dialect* را با *name* مرتبط می‌کند. *name* باید یک رشته باشد. می‌توان گویش را با ارسال یک زیرکلاس از :class:`Dialect`، یا با آرگومان‌های کلیدواژه‌ای *fmtparams*، یا هر دو مشخص کرد؛ در این حالت آرگومان‌های کلیدواژه‌ای پارامترهای گویش را بازنویسی می‌کنند. برای جزئیات کامل درباره گویش‌ها و پارامترهای قالب‌بندی، بخش :ref:`csv-fmt-params` را ببینید." msgid "Delete the dialect associated with *name* from the dialect registry. An :exc:`Error` is raised if *name* is not a registered dialect name." msgstr "گویش مرتبط با *name* را از رجیستری گویش‌ها حذف کنید. اگر *name* یک نام گویش ثبت‌شده نباشد، یک :exc:`Error` پرتاب می‌شود." msgid "Return the dialect associated with *name*. An :exc:`Error` is raised if *name* is not a registered dialect name. This function returns an immutable :class:`Dialect`." msgstr "گویش مرتبط با *name* را برمی‌گرداند. اگر *name* یک نام گویش ثبت‌شده نباشد، یک :exc:`Error` پرتاب می‌شود. این تابع یک :class:`Dialect` تغییرناپذیر برمی‌گرداند." msgid "Return the names of all registered dialects." msgstr "نام تمام گویش‌های ثبت‌شده را برمی‌گرداند." msgid "Returns the current maximum field size allowed by the parser. If *new_limit* is given, this becomes the new limit." msgstr "حداکثر اندازه فیلدی که پارسر در حال حاضر مجاز می‌داند را برمی‌گرداند. اگر *new_limit* داده شود، به حد جدید تبدیل می‌شود." msgid "The :mod:`!csv` module defines the following classes:" msgstr "ماژول :mod:`!csv` کلاس‌های زیر را تعریف می‌کند:" msgid "Create an object that operates like a regular reader but maps the information in each row to a :class:`dict` whose keys are given by the optional *fieldnames* parameter." msgstr "یک شیء ایجاد کنید که مانند یک خواننده معمولی عمل می‌کند، اما اطلاعات هر ردیف را به یک :class:`dict` نگاشت می‌کند که کلیدهای آن توسط پارامتر اختیاری *fieldnames* مشخص می‌شوند." msgid "The *fieldnames* parameter is a :term:`sequence`. If *fieldnames* is omitted, the values in the first row of file *f* will be used as the fieldnames and will be omitted from the results. If *fieldnames* is provided, they will be used and the first row will be included in the results. Regardless of how the fieldnames are determined, the dictionary preserves their original ordering." msgstr "پارامتر *fieldnames* یک :term:`sequence` است. اگر *fieldnames* ارائه نشود، مقدارهای ردیف اول پرونده *f* به‌عنوان fieldnames استفاده می‌شوند و از نتایج حذف خواهند شد. اگر *fieldnames* ارائه شود، از آن‌ها استفاده می‌شود و ردیف اول در نتایج گنجانده خواهد شد. صرف‌نظر از این‌که fieldnames چگونه تعیین می‌شوند، دیکشنری ترتیب اصلی آن‌ها را حفظ می‌کند." msgid "If a row has more fields than fieldnames, the remaining data is put in a list and stored with the fieldname specified by *restkey* (which defaults to ``None``). If a non-blank row has fewer fields than fieldnames, the missing values are filled-in with the value of *restval* (which defaults to ``None``)." msgstr "اگر یک ردیف فیلدهای بیشتری نسبت به fieldnames داشته باشد، داده‌های باقی‌مانده در یک فهرست قرار می‌گیرند و با نام فیلد مشخص‌شده توسط *restkey* (که مقدار پیش‌فرض آن ``None`` است) ذخیره می‌شوند. اگر یک ردیف غیرخالی فیلدهای کمتری نسبت به fieldnames داشته باشد، مقادیر گم‌شده با مقدار *restval* (که مقدار پیش‌فرض آن ``None`` است) پر می‌شوند." msgid "All other optional or keyword arguments are passed to the underlying :class:`reader` instance." msgstr "تمام سایر آرگومان‌های اختیاری یا کلیدواژه‌ای به نمونه‌ی زیربنایی :class:`reader` ارسال می‌شوند." msgid "If the argument passed to *fieldnames* is an iterator, it will be coerced to a :class:`list`." msgstr "اگر آرگومان داده‌شده به *fieldnames* یک پیمایش‌گر باشد، به یک :class:`list` تبدیل می‌شود." msgid "Returned rows are now of type :class:`OrderedDict`." msgstr "ردیف‌های برگردانده‌شده اکنون از نوع :class:`OrderedDict` هستند." msgid "Returned rows are now of type :class:`dict`." msgstr "ردیف‌های برگردانده‌شده اکنون از نوع :class:`dict` هستند." msgid "" ">>> import csv\n" ">>> with open('names.csv', newline='') as csvfile:\n" "... reader = csv.DictReader(csvfile)\n" "... for row in reader:\n" "... print(row['first_name'], row['last_name'])\n" "...\n" "Eric Idle\n" "John Cleese\n" "\n" ">>> print(row)\n" "{'first_name': 'John', 'last_name': 'Cleese'}" msgstr "" ">>> import csv\n" ">>> with open('names.csv', newline='') as csvfile:\n" "... reader = csv.DictReader(csvfile)\n" "... for row in reader:\n" "... print(row['first_name'], row['last_name'])\n" "...\n" "Eric Idle\n" "John Cleese\n" "\n" ">>> print(row)\n" "{'first_name': 'John', 'last_name': 'Cleese'}" msgid "where :file:`names.csv` contains:" msgstr "که :file:`names.csv` شامل موارد زیر است:" msgid "" "first_name,last_name\n" "Eric,Idle\n" "John,Cleese" msgstr "" "first_name,last_name\n" "Eric,Idle\n" "John,Cleese" msgid "Create an object which operates like a regular writer but maps dictionaries onto output rows. The *fieldnames* parameter is a :mod:`sequence ` of keys that identify the order in which values in the dictionary passed to the :meth:`~csvwriter.writerow` method are written to file *f*. The optional *restval* parameter specifies the value to be written if the dictionary is missing a key in *fieldnames*. If the dictionary passed to the :meth:`~csvwriter.writerow` method contains a key not found in *fieldnames*, the optional *extrasaction* parameter indicates what action to take. If it is set to ``'raise'``, the default value, a :exc:`ValueError` is raised. If it is set to ``'ignore'``, extra values in the dictionary are ignored. Any other optional or keyword arguments are passed to the underlying :class:`writer` instance." msgstr "یک شیء ایجاد کنید که مانند یک نویسنده معمولی عمل می‌کند، اما دیکشنری‌ها را به ردیف‌های خروجی نگاشت می‌کند. پارامتر *fieldnames* یک :mod:`دنباله ` از کلیدها است که ترتیب نوشتن مقادیر موجود در دیکشنری ارسال‌شده به متد :meth:`~csvwriter.writerow` در پرونده *f* را مشخص می‌کند. پارامتر اختیاری *restval* مقداری را مشخص می‌کند که در صورت نبودن کلیدی از *fieldnames* در دیکشنری، نوشته می‌شود. اگر دیکشنری ارسال‌شده به متد :meth:`~csvwriter.writerow` شامل کلیدی باشد که در *fieldnames* یافت نمی‌شود، پارامتر اختیاری *extrasaction* مشخص می‌کند که چه عملی باید انجام شود. اگر روی ``'raise'``، که مقدار پیش‌فرض است، تنظیم شود، یک :exc:`ValueError` پرتاب می‌شود. اگر روی ``'ignore'`` تنظیم شود، مقادیر اضافی در دیکشنری نادیده گرفته می‌شوند. سایر آرگومان‌های اختیاری یا کلیدواژه‌ای به نمونه‌ی زیرین :class:`writer` ارسال می‌شوند." msgid "Note that unlike the :class:`DictReader` class, the *fieldnames* parameter of the :class:`DictWriter` class is not optional." msgstr "توجه داشته باشید که برخلاف کلاس :class:`DictReader`، پارامتر *fieldnames* در کلاس :class:`DictWriter` اختیاری نیست." msgid "" "import csv\n" "\n" "with open('names.csv', 'w', newline='') as csvfile:\n" " fieldnames = ['first_name', 'last_name']\n" " writer = csv.DictWriter(csvfile, fieldnames=fieldnames)\n" "\n" " writer.writeheader()\n" " writer.writerow({'first_name': 'Baked', 'last_name': 'Beans'})\n" " writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})\n" " writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})" msgstr "" "import csv\n" "\n" "with open('names.csv', 'w', newline='') as csvfile:\n" " fieldnames = ['first_name', 'last_name']\n" " writer = csv.DictWriter(csvfile, fieldnames=fieldnames)\n" "\n" " writer.writeheader()\n" " writer.writerow({'first_name': 'Baked', 'last_name': 'Beans'})\n" " writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})\n" " writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})" msgid "which writes :file:`names.csv` containing:" msgstr "که :file:`names.csv` را با محتوای زیر می‌نویسد:" msgid "" "first_name,last_name\n" "Baked,Beans\n" "Lovely,Spam\n" "Wonderful,Spam" msgstr "" "first_name,last_name\n" "Baked,Beans\n" "Lovely,Spam\n" "Wonderful,Spam" msgid "The :class:`Dialect` class is a container class whose attributes contain information for how to handle doublequotes, whitespace, delimiters, etc. Due to the lack of a strict CSV specification, different applications produce subtly different CSV data. :class:`Dialect` instances define how :class:`reader` and :class:`writer` instances behave." msgstr "کلاس :class:`Dialect` یک کلاس دربرگیرنده است که ویژگی‌های آن حاوی اطلاعاتی درباره نحوه مدیریت علامت‌های نقل‌قول دوتایی، فضای خالی، جداکننده‌ها و غیره است. به دلیل نبود یک مشخصه دقیق برای CSV، برنامه‌های مختلف داده‌های CSV با تفاوت‌های ظریف تولید می‌کنند. نمونه‌های :class:`Dialect` نحوه رفتار نمونه‌های :class:`reader` و :class:`writer` را تعریف می‌کنند." msgid "All available :class:`Dialect` names are returned by :func:`list_dialects`, and they can be registered with specific :class:`reader` and :class:`writer` classes through their initializer (``__init__``) functions like this::" msgstr "تمام نام‌های موجود :class:`Dialect` توسط :func:`list_dialects` برگردانده می‌شوند، و می‌توان آن‌ها را با کلاس‌های مشخص :class:`reader` و :class:`writer` از طریق توابع مقداردهی اولیه (``__init__``) آن‌ها به این صورت ثبت کرد::" msgid "" "import csv\n" "\n" "with open('students.csv', 'w', newline='') as csvfile:\n" " writer = csv.writer(csvfile, dialect='unix')" msgstr "" "import csv\n" "\n" "with open('students.csv', 'w', newline='') as csvfile:\n" " writer = csv.writer(csvfile, dialect='unix')" msgid "The :class:`excel` class defines the usual properties of an Excel-generated CSV file. It is registered with the dialect name ``'excel'``." msgstr "کلاس :class:`excel` ویژگی‌های معمول یک پرونده CSV تولیدشده توسط Excel را تعریف می‌کند. این کلاس با نام گویش (dialect) ``'excel'`` ثبت شده است." msgid "The :class:`excel_tab` class defines the usual properties of an Excel-generated TAB-delimited file. It is registered with the dialect name ``'excel-tab'``." msgstr "کلاس :class:`excel_tab` ویژگی‌های معمول یک پرونده جداشده با TAB تولیدشده توسط اکسل را تعریف می‌کند. این کلاس با نام گویش ``'excel-tab'`` ثبت شده است." msgid "The :class:`unix_dialect` class defines the usual properties of a CSV file generated on UNIX systems, i.e. using ``'\\n'`` as line terminator and quoting all fields. It is registered with the dialect name ``'unix'``." msgstr "کلاس :class:`unix_dialect` ویژگی‌های معمول یک پرونده CSV تولیدشده در سیستم‌های UNIX را تعریف می‌کند؛ یعنی استفاده از ``'\\n'`` به‌عنوان پایان‌دهنده‌ی خط و در علامت نقل‌قول قرار دادن همه‌ی فیلدها. این کلاس با نام گویش ``'unix'`` ثبت شده است." msgid "The :class:`Sniffer` class is used to deduce the format of a CSV file." msgstr "کلاس :class:`Sniffer` برای استنتاج قالب یک پرونده CSV استفاده می‌شود." msgid "The :class:`Sniffer` class provides two methods:" msgstr "کلاس :class:`Sniffer` دو متد ارائه می‌دهد:" msgid "Analyze the given *sample* and return a :class:`Dialect` subclass reflecting the parameters found. If the optional *delimiters* parameter is given, it is interpreted as a string containing possible valid delimiter characters." msgstr "*sample* داده‌شده را تحلیل کنید و زیرکلاسی از :class:`Dialect` برگردانید که پارامترهای یافت‌شده را بازتاب می‌دهد. اگر پارامتر اختیاری *delimiters* داده شده باشد، به‌عنوان رشته‌ای حاوی نویسه‌هایی تفسیر می‌شود که ممکن است جداکننده‌های معتبری باشند." msgid "If several delimiters fit the sample equally well --- for example if both ``','`` and ``';'`` split every row consistently --- the delimiters listed in the :attr:`~Sniffer.preferred` attribute are preferred, in that order, no matter how many times each of them occurs." msgstr "اگر چند جداکننده به‌اندازه‌ی یکسان با نمونه سازگار باشند --- برای مثال اگر هر دو ``','`` و ``';'`` به‌طور منظم هر ردیف را تقسیم کنند --- جداکننده‌های فهرست‌شده در ویژگی :attr:`~Sniffer.preferred` ترجیح داده می‌شوند، در آن ترتیب، مهم نیست که هر یک چند بار رخ دهد." msgid "Analyze the sample text (presumed to be in CSV format) and return :const:`True` if the first row appears to be a series of column headers. Inspecting each column, one of two key criteria will be considered to estimate if the sample contains a header:" msgstr "متن نمونه را تحلیل می‌کند (فرض می‌شود در قالب CSV باشد) و اگر به نظر برسد که ردیف اول مجموعه‌ای از سرستون‌ها است، :const:`True` را برمی‌گرداند. در بررسی هر ستون، یکی از دو معیار کلیدی برای تخمین اینکه آیا نمونه حاوی سرستون است در نظر گرفته می‌شود:" msgid "the second through n-th rows contain numeric values" msgstr "ردیف‌های دوم تا n-ام شامل مقادیر عددی هستند" msgid "the second through n-th rows contain strings where at least one value's length differs from that of the putative header of that column." msgstr "ردیف‌های دوم تا n-ام شامل رشته‌هایی هستند که در آن‌ها طول دست‌کم یک مقدار با طول سرآیند فرضی آن ستون متفاوت است." msgid "Twenty-one rows after the header are sampled; if more than half of the columns + rows meet the criteria, :const:`True` is returned." msgstr "۲۱ ردیف پس از سرآیند نمونه‌برداری می‌شوند؛ اگر بیش از نیمی از ستون‌ها + ردیف‌ها معیارها را برآورده کنند، :const:`True` برگردانده می‌شود." msgid "This method is a rough heuristic and may produce both false positives and negatives." msgstr "این متد یک هیوریستیک سرانگشتی است و ممکن است هم مثبت‌های کاذب و هم منفی‌های کاذب تولید کند." msgid "The :class:`Sniffer` class has the following attribute:" msgstr "کلاس :class:`Sniffer` ویژگی‌های زیر را دارد:" msgid "The list of the delimiters preferred for breaking ties, in the order of preference. It can be modified. Its initial value is ``[',', '\\t', ';', ' ', ':']``." msgstr "فهرست جداکننده‌های ترجیح‌داده‌شده برای شکستن تساوی، به ترتیب ترجیح. این قابل تغییر است. مقدار اولیه‌ی آن ``[',', '\\t', ';', ' ', ':']`` است." msgid "An example for :class:`Sniffer` use::" msgstr "مثالی برای استفاده از :class:`Sniffer`::" msgid "" "with open('example.csv', newline='') as csvfile:\n" " dialect = csv.Sniffer().sniff(csvfile.read(1024))\n" " csvfile.seek(0)\n" " reader = csv.reader(csvfile, dialect)\n" " # ... process CSV file contents here ..." msgstr "" "with open('example.csv', newline='') as csvfile:\n" " dialect = csv.Sniffer().sniff(csvfile.read(1024))\n" " csvfile.seek(0)\n" " reader = csv.reader(csvfile, dialect)\n" " # ... process CSV file contents here ..." msgid "The :mod:`!csv` module defines the following constants:" msgstr "ماژول :mod:`!csv` ثابت‌های زیر را تعریف می‌کند:" msgid "Instructs :class:`writer` objects to quote all fields." msgstr "به اشیای :class:`writer` دستور می‌دهد که همه فیلدها را داخل علامت نقل‌قول قرار دهند." msgid "Instructs :class:`writer` objects to only quote those fields which contain special characters such as *delimiter*, *quotechar*, ``'\\r'``, ``'\\n'`` or any of the characters in *lineterminator*. If *doublequote* is :const:`False` and *escapechar* is set, the *quotechar* is escaped instead of causing the field to be quoted." msgstr "به شیء‌های :class:`writer` دستور می‌دهد که تنها آن فیلدها را نقل‌قول کند که نویسه‌های خاصی مانند *delimiter*، *quotechar*، ``'\\r'``، ``'\\n'`` یا هر یک از نویسه‌های موجود در *lineterminator* را داشته باشند. اگر *doublequote* برابر با :const:`False` باشد و *escapechar* تنظیم شده باشد، *quotechar* به جای اینکه باعث نقل‌قول شدن فیلد شود، گریز داده می‌شود." msgid "Instructs :class:`writer` objects to quote all non-numeric fields." msgstr "به اشیای :class:`writer` دستور می‌دهد که تمام فیلدهای غیرعددی را در علامت نقل‌قول قرار دهند." msgid "Instructs :class:`reader` objects to convert all non-quoted fields to type :class:`float`." msgstr "به اشیای :class:`reader` دستور می‌دهد که همه فیلدهای بدون علامت نقل‌قول را به نوع :class:`float` تبدیل کنند." msgid "Some numeric types, such as :class:`bool`, :class:`~fractions.Fraction`, or :class:`~enum.IntEnum`, have a string representation that cannot be converted to :class:`float`. They cannot be read in the :data:`QUOTE_NONNUMERIC` and :data:`QUOTE_STRINGS` modes." msgstr "برخی از انواع عددی، مانند :class:`bool`، :class:`~fractions.Fraction` یا :class:`~enum.IntEnum`، نمایش رشته‌ای دارند که نمی‌توان آن را به :class:`float` تبدیل کرد. این موارد را نمی‌توان در حالت‌های :data:`QUOTE_NONNUMERIC` و :data:`QUOTE_STRINGS` خواند." msgid "Instructs :class:`writer` objects to never quote fields. When the current *delimiter*, *quotechar*, *escapechar*, ``'\\r'``, ``'\\n'`` or any of the characters in *lineterminator* occurs in output data it is preceded by the current *escapechar* character. If *escapechar* is not set, the writer will raise :exc:`Error` if any characters that require escaping are encountered. Set *quotechar* to ``None`` to prevent its escaping." msgstr "به اشیای :class:`writer` دستور می‌دهد که هرگز فیلدها را با علامت نقل‌قول محصور نکنند. هنگامی که در حالت فعلی، *delimiter*، *quotechar*، *escapechar*، ``'\\r'``، ``'\\n'`` یا هر یک از نویسه‌های موجود در *lineterminator* در داده خروجی ظاهر شود، نویسه‌ی *escapechar* فعلی پیش از آن قرار می‌گیرد. اگر *escapechar* تنظیم نشده باشد، شیء writer در صورت مواجهه با هر نویسه‌ای که نیاز به خنثی کردن دارد، استثنای :exc:`Error` را پرتاب می‌کند. برای جلوگیری از خنثی شدن *quotechar*، آن را روی ``None`` تنظیم کنید." msgid "Instructs :class:`reader` objects to perform no special processing of quote characters." msgstr "به اشیای :class:`reader` دستور می‌دهد که هیچ پردازش خاصی روی نویسه‌های نقل‌قول انجام ندهند." msgid "Instructs :class:`writer` objects to quote all fields which are not ``None``. This is similar to :data:`QUOTE_ALL`, except that if a field value is ``None`` an empty (unquoted) string is written." msgstr "به اشیای :class:`writer` دستور می‌دهد که تمام فیلدهایی را که ``None`` نیستند، در علامت نقل‌قول قرار دهند. این مشابه :data:`QUOTE_ALL` است، با این تفاوت که اگر مقدار یک فیلد ``None`` باشد، یک رشته خالی (بدون علامت نقل‌قول) نوشته می‌شود." msgid "Instructs :class:`reader` objects to interpret an empty (unquoted) field as ``None`` and to otherwise behave as :data:`QUOTE_ALL`." msgstr "به اشیای :class:`reader` دستور می‌دهد که یک فیلد خالی (بدون علامت نقل‌قول) را به‌عنوان ``None`` تفسیر کنند و در غیر این صورت مانند :data:`QUOTE_ALL` رفتار کنند." msgid "Instructs :class:`writer` objects to always place quotes around fields which are strings. This is similar to :data:`QUOTE_NONNUMERIC`, except that if a field value is ``None`` an empty (unquoted) string is written." msgstr "به اشیای :class:`writer` دستور می‌دهد که همیشه فیلدهایی را که رشته هستند در علامت نقل‌قول قرار دهند. این مشابه :data:`QUOTE_NONNUMERIC` است، با این تفاوت که اگر مقدار یک فیلد ``None`` باشد، یک رشته‌ی خالی (بدون علامت نقل‌قول) نوشته می‌شود." msgid "Instructs :class:`reader` objects to interpret an empty (unquoted) string as ``None`` and to otherwise behave as :data:`QUOTE_NONNUMERIC`." msgstr "به اشیای :class:`reader` دستور می‌دهد که یک رشته خالی (بدون علامت نقل‌قول) را به‌عنوان ``None`` تفسیر کنند و در غیر این صورت مانند :data:`QUOTE_NONNUMERIC` رفتار کنند." msgid "The :mod:`!csv` module defines the following exception:" msgstr "ماژول :mod:`!csv` استثنای زیر را تعریف می‌کند:" msgid "Raised by any of the functions when an error is detected." msgstr "در صورت تشخیص خطا، توسط هر یک از توابع پرتاب می‌شود." msgid "Dialects and formatting parameters" msgstr "گویش‌ها و پارامترهای قالب‌بندی" msgid "To make it easier to specify the format of input and output records, specific formatting parameters are grouped together into dialects. A dialect is a subclass of the :class:`Dialect` class containing various attributes describing the format of the CSV file. When creating :class:`reader` or :class:`writer` objects, the programmer can specify a string or a subclass of the :class:`Dialect` class as the dialect parameter. In addition to, or instead of, the *dialect* parameter, the programmer can also specify individual formatting parameters, which have the same names as the attributes defined below for the :class:`Dialect` class." msgstr "برای آسان‌تر کردن تعیین قالب رکوردهای ورودی و خروجی، پارامترهای قالب‌بندی خاصی در گویش‌ها (dialects) گروه‌بندی شده‌اند. یک گویش، زیرکلاسی از کلاس :class:`Dialect` است که شامل ویژگی‌های مختلفی است که قالب پرونده CSV را توصیف می‌کنند. هنگام ایجاد اشیای :class:`reader` یا :class:`writer`، برنامه‌نویس می‌تواند یک رشته یا زیرکلاسی از کلاس :class:`Dialect` را به‌عنوان پارامتر dialect مشخص کند. علاوه بر، یا به‌جای، پارامتر *dialect*، برنامه‌نویس همچنین می‌تواند پارامترهای قالب‌بندی جداگانه‌ای را مشخص کند که نام‌هایی مشابه ویژگی‌های تعریف‌شده در زیر برای کلاس :class:`Dialect` دارند." msgid "Dialects support the following attributes:" msgstr "گویش‌ها از ویژگی‌های زیر پشتیبانی می‌کنند:" msgid "A one-character string used to separate fields. It defaults to ``','``." msgstr "یک رشته تک‌نویسه‌ای که برای جدا کردن فیلدها استفاده می‌شود. پیش‌فرض آن ``','`` است." msgid "Controls how instances of *quotechar* appearing inside a field should themselves be quoted. When :const:`True`, the character is doubled. When :const:`False`, the *escapechar* is used as a prefix to the *quotechar*. It defaults to :const:`True`." msgstr "کنترل می‌کند که نمونه‌های *quotechar* که درون یک فیلد ظاهر می‌شوند، خود چگونه باید نقل‌قول شوند. هنگامی که :const:`True` باشد، نویسه دو برابر می‌شود. هنگامی که :const:`False` باشد، از *escapechar* به‌عنوان پیشوندی برای *quotechar* استفاده می‌شود. مقدار پیش‌فرض آن :const:`True` است." msgid "On output, if *doublequote* is :const:`False` and no *escapechar* is set, :exc:`Error` is raised if a *quotechar* is found in a field." msgstr "در خروجی، اگر *doublequote* :const:`False` باشد و هیچ *escapechar* تنظیم نشده باشد، در صورتی که یک *quotechar* در یک فیلد یافت شود، :exc:`Error` پرتاب می‌شود." msgid "A one-character string used by the writer to escape characters that require escaping:" msgstr "یک رشته‌ی تک‌نویسه‌ای که نویسنده برای خنثی کردن نویسه‌هایی که نیاز به خنثی‌سازی دارند از آن استفاده می‌کند:" msgid "the *delimiter*, the *quotechar*, ``'\\r'``, ``'\\n'`` and any of the characters in *lineterminator* are escaped if *quoting* is set to :const:`QUOTE_NONE`;" msgstr "اگر *quoting* روی :const:`QUOTE_NONE` تنظیم شده باشد، *delimiter*، *quotechar*، ``'\\r'``، ``'\\n'`` و هر یک از نویسه‌های موجود در *lineterminator* خنثی می‌شوند؛" msgid "the *quotechar* is escaped if *doublequote* is :const:`False`;" msgstr "اگر *doublequote* برابر :const:`False` باشد، *quotechar* خنثی می‌شود؛" msgid "the *escapechar* itself." msgstr "خود *escapechar*." msgid "On reading, the *escapechar* removes any special meaning from the following character. It defaults to :const:`None`, which disables escaping." msgstr "هنگام خواندن، *escapechar* هرگونه معنای خاصی را از نویسه‌ی بعدی می‌گیرد. مقدار پیش‌فرض آن :const:`None` است که خنثی‌سازی را غیرفعال می‌کند." msgid "Previously the *escapechar* itself was not escaped, which lost it on reading." msgstr "پیش از این خودِ *escapechar* گریز داده نمی‌شد، که باعث از دست رفتن آن هنگام خواندن می‌شد." msgid "An empty *escapechar* is not allowed." msgstr "*escapechar* خالی مجاز نیست." msgid "The string used to terminate lines produced by the :class:`writer`. It defaults to ``'\\r\\n'``." msgstr "رشته‌ای که برای پایان‌دادن به سطرهای تولیدشده توسط :class:`writer` استفاده می‌شود. مقدار پیش‌فرض آن ``'\\r\\n'`` است." msgid "The :class:`reader` is hard-coded to recognise either ``'\\r'`` or ``'\\n'`` as end-of-line, and ignores *lineterminator*. This behavior may change in the future." msgstr ":class:`reader` به‌صورت سخت‌کد (hard-coded) برای تشخیص ``'\\r'`` یا ``'\\n'`` به‌عنوان پایان خط تنظیم شده است و *lineterminator* را نادیده می‌گیرد. این رفتار ممکن است در آینده تغییر کند." msgid "A one-character string used to quote fields containing special characters, such as the *delimiter* or the *quotechar*, or which contain new-line characters (``'\\r'``, ``'\\n'`` or any of the characters in *lineterminator*). It defaults to ``'\"'``. Can be set to ``None`` to prevent escaping ``'\"'`` if *quoting* is set to :const:`QUOTE_NONE`." msgstr "یک رشته‌ی تک‌نویسه‌ای که برای نقل‌قول کردن فیلدهای حاوی نویسه‌های خاص، مانند *delimiter* یا *quotechar*، یا فیلدهای حاوی نویسه‌های خط جدید (``'\\r'``، ``'\\n'`` یا هر یک از نویسه‌های موجود در *lineterminator*) استفاده می‌شود. مقدار پیش‌فرض آن ``'\"'`` است. در صورتی که *quoting* روی :const:`QUOTE_NONE` تنظیم شده باشد، می‌توان آن را روی ``None`` تنظیم کرد تا از خنثی کردن ``'\"'`` جلوگیری شود." msgid "An empty *quotechar* is not allowed." msgstr "*quotechar* خالی مجاز نیست." msgid "Controls when quotes should be generated by the writer and recognised by the reader. It can take on any of the :ref:`QUOTE_\\* constants ` and defaults to :const:`QUOTE_MINIMAL` if *quotechar* is not ``None``, and :const:`QUOTE_NONE` otherwise." msgstr "کنترل می‌کند که چه زمانی علامت‌های نقل‌قول باید توسط نویسنده تولید و توسط خواننده شناسایی شوند. این مقدار می‌تواند هر یک از :ref:`ثابت‌های QUOTE_\\* ` را بپذیرد و اگر *quotechar* برابر ``None`` نباشد، پیش‌فرض آن :const:`QUOTE_MINIMAL` است و در غیر این صورت :const:`QUOTE_NONE` است." msgid "When :const:`True`, spaces immediately following the *delimiter* are ignored. The default is :const:`False`. When combining ``delimiter=' '`` with ``skipinitialspace=True``, unquoted empty fields are not allowed." msgstr "هنگامی که :const:`True` باشد، فاصله‌های بلافاصله پس از *delimiter* نادیده گرفته می‌شوند. مقدار پیش‌فرض :const:`False` است. هنگام ترکیب ``delimiter=' '`` با ``skipinitialspace=True``، فیلدهای خالی بدون علامت نقل‌قول مجاز نیستند." msgid "When ``True``, raise exception :exc:`Error` on bad CSV input. The default is ``False``." msgstr "هنگامی که ``True`` باشد، در صورت ورودی CSV نامعتبر، استثنای :exc:`Error` پرتاب می‌شود. مقدار پیش‌فرض ``False`` است." msgid "Reader objects" msgstr "شیءهای خواننده" msgid "Reader objects (:class:`DictReader` instances and objects returned by the :func:`reader` function) have the following public methods:" msgstr "اشیای Reader (نمونه‌های :class:`DictReader` و اشیای برگردانده‌شده از تابع :func:`reader`) دارای متدهای عمومی زیر هستند:" msgid "Return the next row of the reader's iterable object as a list (if the object was returned from :func:`reader`) or a dict (if it is a :class:`DictReader` instance), parsed according to the current :class:`Dialect`. Usually you should call this as ``next(reader)``." msgstr "ردیف بعدی شیء پیمایش‌پذیر reader را به‌عنوان یک فهرست (اگر شیء از :func:`reader` بازگردانده شده باشد) یا یک دیکشنری (اگر یک نمونه :class:`DictReader` باشد)، تجزیه‌شده بر اساس :class:`Dialect` جاری، برمی‌گرداند. معمولاً باید آن را به‌صورت ``next(reader)`` فراخوانی کنید." msgid "Reader objects have the following public attributes:" msgstr "اشیای Reader دارای ویژگی‌های عمومی زیر هستند:" msgid "A read-only description of the dialect in use by the parser." msgstr "توضیحی فقط‌خواندنی درباره‌ی گویش (dialect) مورد استفاده‌ی پارسر ." msgid "The number of lines read from the source iterator. This is not the same as the number of records returned, as records can span multiple lines." msgstr "تعداد سطرهای خوانده‌شده از پیمایش‌گر منبع. این تعداد با تعداد رکوردهای برگردانده‌شده یکسان نیست، زیرا رکوردها می‌توانند شامل چندین خط باشند." msgid "DictReader objects have the following public attribute:" msgstr "اشیای DictReader ویژگی عمومی زیر را دارند:" msgid "If not passed as a parameter when creating the object, this attribute is initialized upon first access or when the first record is read from the file." msgstr "اگر هنگام ایجاد شیء به‌عنوان پارامتر ارسال نشده باشد، این ویژگی در اولین دسترسی یا هنگام خواندن اولین رکورد از پرونده مقداردهی اولیه می‌شود." msgid "Writer objects" msgstr "شیءهای نویسنده" msgid ":class:`writer` objects (:class:`DictWriter` instances and objects returned by the :func:`writer` function) have the following public methods. A *row* must be an iterable of strings or numbers for :class:`writer` objects and a dictionary mapping fieldnames to strings or numbers (by passing them through :func:`str` first) for :class:`DictWriter` objects. Note that complex numbers are written out surrounded by parens. This may cause some problems for other programs which read CSV files (assuming they support complex numbers at all)." msgstr "اشیای :class:`writer` (نمونه‌های :class:`DictWriter` و اشیایی که تابع :func:`writer` برمی‌گرداند) دارای متدهای عمومی زیر هستند. برای اشیای :class:`writer`، یک *ردیف* باید یک پیمایش‌پذیر از رشته‌ها یا اعداد باشد و برای اشیای :class:`DictWriter` باید یک دیکشنری باشد که نام فیلدها را به رشته‌ها یا اعداد نگاشت می‌کند (با اعمال :func:`str` روی آن‌ها در ابتدا). توجه داشته باشید که اعداد مختلط با پرانتز در اطرافشان نوشته می‌شوند. این موضوع ممکن است برای برنامه‌های دیگری که پرونده‌های CSV را می‌خوانند (اگر اصلاً از اعداد مختلط پشتیبانی کنند) مشکلاتی ایجاد کند." msgid "Write the *row* parameter to the writer's file object, formatted according to the current :class:`Dialect`. Return the return value of the call to the *write* method of the underlying file object." msgstr "پارامتر *row* را در شیء فایلِ نویسنده، با قالب‌بندی مطابق :class:`Dialect` جاری بنویسید. مقدار بازگشتیِ فراخوانی متد *write* شیء پرونده زیربنایی را برگردانید." msgid "Added support of arbitrary iterables." msgstr "پشتیبانی از پیمایش‌پذیرهای دلخواه افزوده شد." msgid "Write all elements in *rows* (an iterable of *row* objects as described above) to the writer's file object, formatted according to the current dialect." msgstr "تمام عناصر موجود در *rows* (یک پیمایش‌پذیر از اشیای *row* همان‌گونه که در بالا توضیح داده شد) را در شیء پرونده نویسنده می‌نویسد، به‌صورت قالب‌بندی‌شده بر اساس گویش (dialect) جاری." msgid "Writer objects have the following public attribute:" msgstr "اشیای Writer دارای ویژگی عمومی زیر هستند:" msgid "A read-only description of the dialect in use by the writer." msgstr "توضیحی فقط‌خواندنی از گویش (dialect) که نویسنده از آن استفاده می‌کند." msgid "DictWriter objects have the following public method:" msgstr "اشیای DictWriter دارای متد عمومی زیر هستند:" msgid "Write a row with the field names (as specified in the constructor) to the writer's file object, formatted according to the current dialect. Return the return value of the :meth:`csvwriter.writerow` call used internally." msgstr "ردیفی شامل نام فیلدها (همان‌طور که در سازنده مشخص شده است) را در شیء فایلِ نویسنده بنویسید؛ این ردیف مطابق گویش (dialect) جاری قالب‌بندی می‌شود. مقدار بازگشتیِ فراخوانی داخلی :meth:`csvwriter.writerow` را برگردانید." msgid ":meth:`writeheader` now also returns the value returned by the :meth:`csvwriter.writerow` method it uses internally." msgstr ":meth:`writeheader` اکنون نیز مقداری را که متد :meth:`csvwriter.writerow`، که به‌صورت داخلی استفاده می‌شود، برمی‌گرداند، برمی‌گرداند." msgid "Examples" msgstr "مثال‌ها" msgid "The simplest example of reading a CSV file::" msgstr "ساده‌ترین مثال برای خواندن یک پرونده CSV::" msgid "" "import csv\n" "with open('some.csv', newline='') as f:\n" " reader = csv.reader(f)\n" " for row in reader:\n" " print(row)" msgstr "" "import csv\n" "with open('some.csv', newline='') as f:\n" " reader = csv.reader(f)\n" " for row in reader:\n" " print(row)" msgid "Reading a file with an alternate format::" msgstr "خواندن یک پرونده با قالب جایگزین::" msgid "" "import csv\n" "with open('passwd', newline='') as f:\n" " reader = csv.reader(f, delimiter=':', quoting=csv.QUOTE_NONE)\n" " for row in reader:\n" " print(row)" msgstr "" "import csv\n" "with open('passwd', newline='') as f:\n" " reader = csv.reader(f, delimiter=':', quoting=csv.QUOTE_NONE)\n" " for row in reader:\n" " print(row)" msgid "The corresponding simplest possible writing example is::" msgstr "ساده‌ترین مثال ممکن برای نوشتن، متناظر با آن، به این صورت است::" msgid "" "import csv\n" "with open('some.csv', 'w', newline='') as f:\n" " writer = csv.writer(f)\n" " writer.writerows(someiterable)" msgstr "" "import csv\n" "with open('some.csv', 'w', newline='') as f:\n" " writer = csv.writer(f)\n" " writer.writerows(someiterable)" msgid "Since :func:`open` is used to open a CSV file for reading, the file will by default be decoded into Unicode using UTF-8. To decode a file using a different encoding, use the ``encoding`` argument of open::" msgstr "از آنجا که تابع :func:`open` برای گشودن یک پرونده‌ی CSV به منظور خواندن استفاده می‌شود، پرونده به طور پیش‌فرض با استفاده از UTF-8 به یونیکد رمزگشایی خواهد شد. برای رمزگشایی یک پرونده با استفاده از یک کدگذاری متفاوت، از آرگومان ``encoding`` در open استفاده کنید::" msgid "" "import csv\n" "with open('some.csv', newline='', encoding='latin-1') as f:\n" " reader = csv.reader(f)\n" " for row in reader:\n" " print(row)" msgstr "" "import csv\n" "with open('some.csv', newline='', encoding='latin-1') as f:\n" " reader = csv.reader(f)\n" " for row in reader:\n" " print(row)" msgid "The same applies to writing in something other than the default encoding: specify the encoding argument when opening the output file." msgstr "همین امر برای نوشتن با کدگذاری‌ای غیر از کدگذاری پیش‌فرض نیز صدق می‌کند: هنگام گشودن پرونده‌ی خروجی، آرگومان encoding را مشخص کنید." msgid "Registering a new dialect::" msgstr "ثبت یک گویش جدید::" msgid "" "import csv\n" "csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)\n" "with open('passwd', newline='') as f:\n" " reader = csv.reader(f, 'unixpwd')" msgstr "" "import csv\n" "csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)\n" "with open('passwd', newline='') as f:\n" " reader = csv.reader(f, 'unixpwd')" msgid "A slightly more advanced use of the reader --- catching and reporting errors::" msgstr "یک کاربرد کمی پیشرفته‌تر از reader --- گرفتن و گزارش خطاها::" msgid "" "import csv, sys\n" "filename = 'some.csv'\n" "with open(filename, newline='') as f:\n" " reader = csv.reader(f)\n" " try:\n" " for row in reader:\n" " print(row)\n" " except csv.Error as e:\n" " sys.exit(f'file {filename}, line {reader.line_num}: {e}')" msgstr "" "import csv, sys\n" "filename = 'some.csv'\n" "with open(filename, newline='') as f:\n" " reader = csv.reader(f)\n" " try:\n" " for row in reader:\n" " print(row)\n" " except csv.Error as e:\n" " sys.exit(f'file {filename}, line {reader.line_num}: {e}')" msgid "And while the module doesn't directly support parsing strings, it can easily be done::" msgstr "و با وجود اینکه ماژول مستقیماً از تجزیه‌ی رشته‌ها پشتیبانی نمی‌کند، این کار به‌راحتی قابل انجام است::" msgid "" "import csv\n" "for row in csv.reader(['one,two,three']):\n" " print(row)" msgstr "" "import csv\n" "for row in csv.reader(['one,two,three']):\n" " print(row)" msgid "Footnotes" msgstr "پانویس‌ها" msgid "If ``newline=''`` is not specified, newlines embedded inside quoted fields will not be interpreted correctly, and on platforms that use ``\\r\\n`` line endings on write an extra ``\\r`` will be added. It should always be safe to specify ``newline=''``, since the csv module does its own (:term:`universal `) newline handling." msgstr "اگر ``newline=''`` مشخص نشود، سطرهای جدید نهفته در فیلدهای نقل‌قول‌شده به‌درستی تفسیر نمی‌شوند، و در سکوهایی که هنگام نوشتن از پایان‌سطرهای ``\\r\\n`` استفاده می‌کنند، یک ``\\r`` اضافی افزوده می‌شود. مشخص کردن ``newline=''`` باید همیشه ایمن باشد، زیرا ماژول csv مدیریت خط جدید (:term:`سطرهای جدید همگانی (universal newlines) `) خود را انجام می‌دهد." msgid "csv" msgstr "csv" msgid "data" msgstr "داده" msgid "tabular" msgstr "جدولی" msgid "universal newlines" msgstr "سطرهای جدید همگانی (universal newlines)" msgid "csv.reader function" msgstr "تابع csv.reader"