从 beam.io.WriteToText 中删除换行符
Remove newline from beam.io.WriteToText
有没有办法阻止 Apache Beam beam.io.WriteToText 函数在每个项目后创建一个新行?我希望能够使用条件语句仅输出某些数据,但是,条件语句未返回的行导致将空行写入输出文件。
你应该可以设置 append_trailing_newlines=False
例如:
with beam.Pipeline(options=pipeline_options) as p:
...
p_to_write | WriteToText(file_path_to_write_to, append_trailing_newlines=False)
参见文档 here。
有没有办法阻止 Apache Beam beam.io.WriteToText 函数在每个项目后创建一个新行?我希望能够使用条件语句仅输出某些数据,但是,条件语句未返回的行导致将空行写入输出文件。
你应该可以设置 append_trailing_newlines=False
例如:
with beam.Pipeline(options=pipeline_options) as p:
...
p_to_write | WriteToText(file_path_to_write_to, append_trailing_newlines=False)
参见文档 here。