Last active
January 4, 2017 14:31
-
-
Save dodikk/101cc2907e713832554f8c04630e58cc to your computer and use it in GitHub Desktop.
Get the list of project contributors by parsing the manually collected SublimeText search results
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 | |
lineIndex = 0 | |
result = [] | |
with open ("contributors-raw.txt") as f: | |
for line in f.readlines(): | |
# skip filename before find result | |
# skip blank line after find result | |
lineMiniIndex = lineIndex % 3 | |
if (1 == lineMiniIndex): | |
# 2: // Created by {0} on {1} | |
nameStartIndex = line.find(" Created by ") + len(" Created by ") | |
nameEndIndex = line.find(" on ", nameStartIndex, len(line)) | |
name = line[nameStartIndex:nameEndIndex] | |
# add formatting for file output | |
nameWithNewLine = name + "\n" | |
# distinct | |
if nameWithNewLine not in result: | |
result.append(nameWithNewLine) | |
lineIndex = lineIndex + 1 | |
with open("contributors-distinct.txt", "w+") as destinationFile: | |
destinationFile.writelines(result) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment