मराठी
तामिळनाडू बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान इयत्ता १२

Write the rules to be followed to format the data in a CSV file.

Advertisements
Advertisements

प्रश्न

Write the rules to be followed to format the data in a CSV file.

थोडक्यात उत्तर
Advertisements

उत्तर

1. Each record (row of data) is to be located on a separate line, delimited by a line break by pressing the enter key.
Example:
xxx.yyy↵(↵denotes enter Key to be pressed)

2. The last record in the file may or may not have an ending line break.
Example:
ppp,qqq↵
yyy, xxx

3. There may be an optional header line appearing as the first line of the file with the same format as normal record lines. The header will contain names corresponding to the fields in the file and should contain the same number of fields as the records in the rest of the file.
Example:
field_name 1,field_name2,field_name3
zzz,yyy, xxx CRLF(Carriage Return and Line Feed)

4. Within the header and each record, there may be one or more fields, separated by commas. Spaces are considered part of a field and should not be ignored. The last field in the record must not be followed by a comma.
Example:
Red, Blue

5. Each field mayor may not be enclosed in double-quotes. If fields are not enclosed with double quotes, then double quotes may not appear inside the fields
Example.
“Red”,” Blue”,” Green”↵ #Field data with” ‘
Black, White, Yellow #Field data without double quotes

6. Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double quotes.
Example:
Red, Blue, Green

7. If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be preceded with another double quote.
Example:
“Red,” “Blue”, “Green”

shaalaa.com
Read and Write a CSV File Using Python
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 13: Python and CSV files - Evaluation [पृष्ठ २६६]

APPEARS IN

सामाचीर कलवी Computer Science [English] Class 12 TN Board
पाठ 13 Python and CSV files
Evaluation | Q 5. | पृष्ठ २६६
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×