You are writing data to a CSV file using csv.writer. You want to ensure that row delimiters are handled correctly across different operating systems. What should you set the 'lineterminator' parameter to?
Trap 1: lineterminator='\n'
This may cause issues on Windows systems expecting \r\n.
Trap 2: lineterminator=os.linesep
Using os.linesep relies on the current system, which might not match the desired output format for other platforms.
Trap 3: lineterminator='\r'
This is only for legacy Mac systems.
- A
lineterminator='\n'
Why wrong: This may cause issues on Windows systems expecting \r\n.
- B
lineterminator=os.linesep
Why wrong: Using os.linesep relies on the current system, which might not match the desired output format for other platforms.
- C
lineterminator='\r\n'
Using \r\n is the standard way to ensure consistency across systems.
- D
lineterminator='\r'
Why wrong: This is only for legacy Mac systems.