Created
April 3, 2023 10:39
-
-
Save arnaldoleandro/be5dd30b23e22416b22700dc76c838f7 to your computer and use it in GitHub Desktop.
stores xml's root tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_root_tag(input_file): | |
with open(input_file, 'r', encoding='utf-8') as file: | |
file.readline() | |
second_line = file.readline().strip() | |
root_tag = second_line[1:].split(' ', 1)[0] | |
return root_tag[:-1] if root_tag.endswith('>') else root_tag |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment