我可以使用python来定义这样的单词:
x=raw_input("Enter Word: ")
x=define(x)
print x
Run Code Online (Sandbox Code Playgroud)
这可能吗?如果si ..怎么做2?
这只是一个"假设"的问题..所以没有讨厌PLZ.
您可以使用re和urllib2模块来执行此操作.尝试使用此代码dawg.
import re
import urllib2
def find(x):
srch=str(x)
x=urllib2.urlopen("http://dictionary.reference.com/browse/"+srch+"?s=t")
x=x.read()
items=re.findall('<meta name="description" content="'+".*$",x,re.MULTILINE)
for x in items:
y=x.replace('<meta name="description" content="','')
z=y.replace(' See more."/>','')
m=re.findall('at Dictionary.com, a free online dictionary with pronunciation, synonyms and translation. Look it up now! "/>',z)
if m==[]:
if z.startswith("Get your reference question answered by Ask.com"):
print "Word not found! :("
else:
print z
else:
print "Word not found! :("
x=raw_input("Enter word to find: ")
find(x)
Run Code Online (Sandbox Code Playgroud)
让我知道事情的后续!
| 归档时间: |
|
| 查看次数: |
6146 次 |
| 最近记录: |