[英]How to create a text file with windows line ending (CRLF) using pyspark?
I have a dynamic frame created with the required data.我有一个使用所需数据创建的动态框架。 I'm using pyspark in aws glue job.
我在 aws 胶水作业中使用 pyspark。 I'm creating a file as below
我正在创建一个文件如下
df_final_data.coalesce.write.format("text").option("mode", "append").save(var_bucket)
But this is creating a file with LF line endings.但这是创建一个带有 LF 行结尾的文件。
How can I create a file with CRLF line endings or is there a way to replace these LF to CRLF after the file is created?如何创建带有 CRLF 行结尾的文件,或者有没有办法在创建文件后将这些 LF 替换为 CRLF?
Try using the lineSep
parameter:尝试使用
lineSep
参数:
df_final_data.coalesce.write.format("text").option("lineSep", "\r\n").option("mode", "append").save(var_bucket)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.