我正在尝试解析测试文件.该文件具有以下格式的用户名,地址和电话:
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中.任何提示或帮助将不胜感激.