Thursday, 15 August 2013

Remove element out of tuple

Remove element out of tuple

I have a tuple in moy code:
('H', 'NNP')
This is the code:
# -*- coding: utf-8 -*-
from nltk.corpus import wordnet as wn
from nltk import pos_tag
import nltk
syno =[]
sentence = '''His father suggested he study to become a parson instead,
but Darwin was far more inclined to study natural history.DarwinDar·win
(där'wĭn),Charles Robert.1809-1882.British naturalist who
revolutionized the study of biology with his theory ofevolutionbased on
natural selection
Like several scientists before him, Darwin believed all the life on earth
evolved (developed gradually) over millions of years from a few common
ancestors.'''
sent = pos_tag(sentence)
alpha = [s for s in sent if s[1] == 'NNP']
for i in range(0,len(alpha)-1):
print alpha[i] #return the tuple
I want to remove only H from this. How can i do so?

No comments:

Post a Comment