Syntax Highlighting

Haiyang Ai

Administrator
This thread is for testing purpose only. Please ignore.

[xcode=python]
def pyFunction():
for i in range(10):
print i
[/xcode]
 
回复: Syntax Highlighting

Still testing...

[xcode=python]
# loop
for i in range(10):
print i
[/xcode]
 
回复: Syntax Highlighting

More testing...

[XCODE=python]
def Cut(cutlist,lines):
l = []
line = []

for i in lines:
if FindTok(cutlist,i):
l.append("".join(line))
l.append(i)
line = []
else:
line.append(i)
return l

cutlist = "[。,,!……!《》<>\"'::?\?、\|“”‘’;]{}(){}【】(){}():?!。,;、~——+%%`:“”"'‘\n\r".decode('gbk')
for lines in file(inputfilename):
l = Cut(list(cutlist),list(lines.decode('gbk')))
for line in l:
if line.strip() <> "": #这里可能包含空格
li = line.strip().split()
for sentence in li:
print "se:",sentence
[/XCODE]
 
Back
顶部