HTML Template ��������� Generating ������ ��������� ���������, �������������� ������ ������ HTML ��������� ��������������� SigntureSurvey ��� ��������� ��������������� ������ ������ ���������까 ��������� ���������. 그������ 간������게 ������������고, ��������� View ��� ������ ��� ������까 구경���������.
Plex ������.
Plex ������.
~cpp from Plex import * import StringIO class HtmlSigSurveyer(Scanner): def repl_tagEnd(self, aText): self.begin('') result = "." * (len(aText)-1) + ">"+ str(len(aText)-1) +"\n" return result def repl_tagChar(self, aText): return "." def repl_normalString(self, aText): return aText def repl_tagStart(self, aText): self.begin('tag') return aText def repl_enter(self, aText): return "\n" def repl_whiteSpace(self, aText): return "" tagStart = Str("<") tagEnd = Rep1(AnyBut(">")) + Str(">") enterCode = Str("\n") whiteSpace = Rep1(Str(" ")) | Rep1(Str("\t")) lexicon = Lexicon([ (tagStart, repl_tagStart), State('tag', [ (tagEnd, repl_tagEnd), (enterCode, repl_enter), (AnyChar, repl_tagChar) ]), (whiteSpace, repl_whiteSpace), (AnyChar, repl_normalString), ]) def __init__(self, aStream): Scanner.__init__(self, self.lexicon, aStream) def process(self): writer = StringIO.StringIO("") while True: token = self.read() if token[0] is None: break writer.write(token[0]) return writer.getvalue() def readFromFile(aFileName): f = open(aFileName, 'r') text = f.read() f.close() return text def writeToFile(aFileName, aStr): f = open(aFileName, 'w') f.write(aStr) f.close() if __name__=="__main__": data = readFromFile("sig.html") surveyer = HtmlSigSurveyer(StringIO.StringIO(data)) result = surveyer.process() lines = [line for line in result.splitlines() if line.strip() != ''] count = 1 for line in lines: print count, line count +=1
결과������ ����� ������과 �����������.
��������� ��������� ��� ����� ������������. <> ���그 ��������� ��� ���������� �������� ������������������ ��������� ����� ������게 ���기 ������ C & P ��� ������ ��������� ������. 그������ 그 ��������� ��������� looping ��� ������ ��������� ��������� ����� �����. ��������� ���������고 ������ ������������ ��������� ��������� ������������ ��������� ������������ ����� ��� ��� ������. 그 ��������� ������ ��������� 1������������ �������� ���고, generating ��������� ������������ ��������������� ������ ��������.
~cpp 1 <............................................................>60 2 <..>2 3 <..........................>26 4 <...>3 5 <...>3 6 <..>2 7 <.........................>25 8 <..........................................................................>74 9 <...>3 10 <................................>32 11 <..........................................................................>74 12 <..>2 13 <..>2 14 <...............................................................................................>95 15 <.................................................>49 16 TV<..>2 17 <...............................................................................................>95 18 <.................................................>49 19 VTR<..>2 20 <...............................................................................................>95 21 <.................................................>49 22 DVD<..>2 23 <...............................................................................................>95 24 <.................................................>49 25 ������������<..>2 26 <...............................................................................................>95 27 <.................................................>49 28 ������고<..>2 29 <...............................................................................................>95 30 <.................................................>49 31 ������기<..>2 32 <...............................................................................................>95 33 <.................................................>49 34 ���������<..>2 35 <...............................................................................................>95 36 <.................................................>49 37 ���������<..>2 38 <...............................................................................................>95 39 <.................................................>49 40 ���������/������기<..>2 41 <..>2 42 <.......................>23 43 <..............................................................................................>94 44 <...............................................................................................>95 45 <..>2 46 <.....................................................>53 47 <.............................................................>61 . . .������ ��������������� 4-5point ��� ������������ 2��� ������������ ���������. ������ ��������� ������ ������������ ���������.
��������� ��������� ��� ����� ������������. <> ���그 ��������� ��� ���������� �������� ������������������ ��������� ����� ������게 ���기 ������ C & P ��� ������ ��������� ������. 그������ 그 ��������� ��������� looping ��� ������ ��������� ��������� ����� �����. ��������� ���������고 ������ ������������ ��������� ��������� ������������ ��������� ������������ ����� ��� ��� ������. 그 ��������� ������ ��������� 1������������ �������� ���고, generating ��������� ������������ ��������������� ������ ��������.
��������������� ���������게 ��������� ������ ���������, SignatureSurvey ��� ������������ Duplication Code ��� ������ ������������ ������������ ������ ��� ������ ������까 ������ ��������� ���������.
--1002
--1002