Chinaunix
标题:
求助: 列表 文本处理
[打印本页]
作者:
huanhuolang
时间:
2011-04-04 21:11
标题:
求助: 列表 文本处理
#s为句法树
s = '''(ROOT
(S
(PP (IN In)
(NP (DT this) (NN study)))
(, ,)
(NP (PRP we))
(VP (VBD examined)
(NP
(NP (DT the) (NN expression))
(PP (IN of)
(NP (JJ let-7) (NNS miRNAs))))
(PP (IN in)
(NP
(NP (JJ human) (NN colon) (NN cancer) (NNS tumors))
(CC and)
(NP (NN cell) (NNS lines))))
(, ,)
(PP (IN with)
(NP
(NP (DT the) (NN result))
(SBAR (IN that)
(S
(NP
(NP (CD 2))
(PP (IN of)
(NP
(NP (CD 6) (NNS cases))
(CC and)
(NP (CD 1))))
(PP (IN of)
(NP (CD 3) (NN cell) (NNS lines))))
(VP (VBD showed)
(NP
(NP (VBN reduced) (NN expression))
(PP (IN of)
(NP (NN let-7))))))))))
(. .)))
'''
str1="reduced"
str2="let-7"
temp=[]
link=[]
s=s.replace('(', ' ( ')
s=s.replace(')', ' ) ')
list=s.split()
print list
for word in list:
#print word,
while True:
string=list.pop(0)
temp.append(string)
#print string,
if string==')':
break
print temp
复制代码
请问:这个为什么读不到底 ?先谢谢了
作者:
huanhuolang
时间:
2011-04-05 13:59
自己顶下 ~~~~~~~~~~~
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2