This is my code:
class LangList(SGMLParser):
is_span = ""
langs = []
def start_span(self, attrs):
for key, value in attrs:
if key == 'class' and value == 'lang':
self.is_span = 1
def end_span(self):
self.is_span = ""
def handle_data(self, text):
if self.is_span:
self.langs.append(text)
...
for key in my_repositories.repositories.keys():
print key
each_repository_content = urllib2.urlopen(my_repositories.repositories[key]).read()
my_repository = LangList()
my_repository.feed(each_repository_content)
print my_repository.langs
This is result:
forensic_tools
['Python']
google
['Python', 'Python']
ListServices
['Python', 'Python', 'Java', 'Perl']
win32-assembly-projects
['Python', 'Python', 'Java', 'Perl', 'C']
...
I am coding a application that get information of repositories from github member.
When I output array, I find array hasn't been initial and exists repeat element. How do I solve this problem?