Created
December 5, 2011 09:26
-
-
Save goghvanmr/1432991 to your computer and use it in GitHub Desktop.
TedHelper
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
def get_languages(self): | |
pattern = re.compile(r'<select name="languageCode" id="languageCode">([\s\S]*?)</select>') | |
var = pattern.search(self._html_ted) | |
if var is not None: | |
var = var.group(1) | |
else: | |
return None | |
var = [eachOption.strip() for eachOption in var.split('\n')] | |
var = var[:len(var)-1] | |
var = [eachOption[15:-9] for eachOption in var] | |
var = [re.split('".*?>', eachOption) for eachOption in var] | |
return dict(var) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment