小编taf*_*ela的帖子

文本文件数据解析行和输出为列

我正在尝试解析测试文件.该文件具有以下格式的用户名,地址和电话:

Name: John Doe1
address : somewhere
phone: 123-123-1234

Name: John Doe2
address : somewhere
phone: 123-123-1233

Name: John Doe3
address : somewhere
phone: 123-123-1232
Run Code Online (Sandbox Code Playgroud)

仅适用于近1万用户:)我想要做的是将这些行转换为列,例如:

Name: John Doe1                address : somewhere          phone: 123-123-1234
Name: John Doe2                address : somewhere          phone: 123-123-1233
Name: John Doe3                address : somewhere          phone: 123-123-1232
Run Code Online (Sandbox Code Playgroud)

我更愿意这样做,bash但是如果你知道如何在python中做到这一点也很棒,那么拥有这些信息的文件在/ root/docs/information中.任何提示或帮助将不胜感激.

python bash scripting parsing

8
推荐指数
1
解决办法
1269
查看次数

标签 统计

bash ×1

parsing ×1

python ×1

scripting ×1