-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
你好,现在已经是用不了了,我改了改,本人python不太熟悉,小改了下 #3
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your PR. This script has not been used/tested/maintained for a long time. I personally don't use it anymore. so please consider my review feedback and feel free to submit another change.
@@ -9,7 +10,7 @@ def add_new_line(obj): | |||
if len(sys.argv) != 2: | |||
print('usage: %s <word>' % sys.argv[0]) | |||
else: | |||
word = re.sub(' ', '_', sys.argv[1]) #enable translate a sentence | |||
word = quote(sys.argv[1]) #enable translate a sentence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use urllib.quote and don't need to import quote from urllib.
result = dict[0].getText(' ') #only show the first match, which seems best | ||
result = re.sub(' ', ' ', result) #replace the HTML space symbol | ||
result = re.sub('[\s]{4,}', '\n', result) #remove redundent spaces | ||
result = re.sub('\d+\. ', add_new_line, result) #highlight the groups | ||
result = re.sub("\(function\(\)[\s\S]*",' ', result) | ||
result = re.sub(u"一元好课[\s\S]*",' ', result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try using a wilder pattern so that if the website changes again we don't need to change the code.
No description provided.