Created
December 2, 2015 15:41
-
-
Save patrickhammond/1742866c090b1d85d336 to your computer and use it in GitHub Desktop.
Finds duplicate string values in an Android strings.xml file.
This file contains hidden or 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
#!/usr/bin/python | |
import sys | |
import xml.etree.ElementTree | |
import collections | |
xmlFile = sys.argv[1] | |
strings = collections.Counter() | |
root = xml.etree.ElementTree.parse(xmlFile).getroot() | |
for string in root.findall('string'): | |
text = string.text | |
name = string.get('name') | |
if strings[text] == 0: | |
strings[text] = name | |
else: | |
print(name + " has the same value as " + strings[text]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment