[lxml] Re: Turn three-line block into single?

2022-08-08 Thread Gilles
Thanks mucho. The script fails on this particular line: """   File "remove.dups.py", line 54, in     print(f"type(entries.children = {','.join(str(type(c)) for c in entries.getchildren())}") AttributeError: 'NoneType' object has no attribute 'getchildren' """ print(f"type(entries.children = {'

[lxml] Re: Turn three-line block into single?

2022-08-08 Thread Adrian Bool
Hi Gilles, I guess you're intending on using 'sort -u' on your data? An alternative would be to de-dup the data as XML instead of as text. Here is something to play with... For the input file: London Paris

[lxml] Turn three-line block into single?

2022-08-08 Thread Gilles
Hello, Before I  resort to a regex, I figured I should ask here. To find and remove possible duplicates, I need to turn each block into a single line: FROM       blah   TO   blah Do you know of a way to do this in lxml? Thank you. ___ lxml -