>> Edit article
이름
제목
패스워드
참 좋은데요 이쁘고... 헌데. 이상하게 제 한텀에서는 한글이 가끔 깨져서 나오네요 :( 나만 그런건지?? 그래서 파이썬으로 다시 만들어 봤슴다. #!/usr/bin/env python import urllib import formatter import htmllib import string import cStringIO import tempfile import re import os def toText(str): out = cStringIO.StringIO() w = formatter.DumbWriter(out) f = formatter.AbstractFormatter(w) p = htmllib.HTMLParser(f) p.feed(str) p.close() return out.getvalue() while 1: word = raw_input("찾는 단어: ") url = "http://kr.engdic.yahoo.com/result.html?p=%s" % string.strip(word) m = re.compile("(image)") data = m.sub("", toText(urllib.urlopen(url).read())) file = tempfile.mktemp() f = open(file, 'w') tmp = string.split(data[:-388], '[17]') #XXX -388?? f.write(tmp[1]) f.close() print "-"*80 os.system("cat %s |more" % file) os.unlink(file) print "-"*80 : Yahoo 영어사전을 이용하는 것입니다. : 참고 ^[ 의 입력은 CTRL+V+[ 로 합니다. : 모양 이쁘게 만들어 보려고 하다보니 조금 복잡해 졌습니다. : : #!/bin/sh : : ED_query() : { : echo -n "^[[01;37m찾을 단어: ^[[00m" : read WORD : echo : : [ -n "${WORD}" ] || exit : } : : ED_encode() : { : WORD=$* : WORD=$(echo ${WORD} | od -tx1 -w1000 | head -1 | : sed -e 's/^[0-9]+ //' -e 's/ 0a$//' -e 's/20/+/g' : -e 's/ /%/g' -e 's/^/%/' | tr '[a-z]' '[A-Z]') : : echo -n ${WORD} : } : : ED_result() : { : WORD=$* : lynx -nolist -color -dump : http://kr.engdic.yahoo.com/result.html?p=${WORD} : | grep -v "bu2.gif" | tail +14 | tac | tail +11 | tac : | sed -e 's/[phon[0-9]+.gif] //g' : -e 's/[phon[0-9]+.gif]//g' : -e 's/^/^[[01;32m|^[[00m/' | more : } : : WORD=$* : : while true; do : [ -z "${WORD}" ] && ED_query : : WORD=$(ED_encode "${WORD}") : : echo -n "^[[01;32m+------------------------------ " : echo -n "^[[01;33m영어사전" : echo -n "^[[01;32m -------------------------------------+^[[00m" : echo : ED_result "${WORD}" && unset WORD : echo "^[[01;32m|^[[00m" : echo -n "^[[01;32m+-------------------------------------------" : echo "----------------------------------+^[[00m" : echo : done : : -- : 아.지.사.바
Copyleft
1999-2026 by
JSBoard Open Project
Theme Designed by
IDOO
All right reserved