Why isn't SPLIT splitting my strings

ronrsr ronrsr at gmail.com
Sun Nov 19 11:14:45 CET 2006


I'm trying to break up the result tuple into keyword phrases.  The
keyword phrases are separated by a ;  -- the split function is not
working the way I believe it should be. Can anyone see what I"m doing
wrong?

bests,

-rsr-



 print "newstring =", str(result[i][0])
        print "just split", str(result[i][0]).split('; ()[]"')
        zd.append(str(result[i][0]).split('; ()[]"'))


result= (('Agricultural subsidies; Foreign aid',), ('Agriculture;
Sustainable Agriculture - Support; Organic Agriculture; Pesticides, US,
Childhood Development, Birth Defects; Toxic Chemicals',),
('Antibiotics, Animals',), ('Agricultural Subsidies, Global Trade',),
('Agricultural Subsidies',), ('Biodiversity',), ('Citizen Activism',),
('Community Gardens',), ('Cooperatives',), ('Dieting',), ('Agriculture,
Cotton',), ('Agriculture, Global Trade',), ('Pesticides, Monsanto',),
('Agriculture, Seed',), ('Coffee, Hunger',), ('Pollution, Water,
Feedlots',), ('Food Prices',), ('Agriculture, Workers',), ('Animal
Feed, Corn, Pesticides',), ('Aquaculture',), ('Chemical Warfare',),
('Compost',), ('Debt',), ('Consumerism',), ('Fear',), ('Pesticides, US,
Childhood Development, Birth Defects',), ('Corporate Reform,
Personhood (Dem. Book)',), ('Corporate Reform,  Personhood, Farming
(Dem. Book)',), ('Crime Rates, Legislation, Education',), ('Debt,
Credit Cards',), ('Democracy',), ('Population, World',), ('Income',),
('Democracy, Corporate



partial results:

string a =  Agricultural subsidies; Foreign aid
newstring = Agricultural subsidies; Foreign aid
just split ['Agricultural subsidies; Foreign aid']
newstring = Agriculture; Sustainable Agriculture - Support; Organic
Agriculture; Pesticides, US, Childhood Development, Birth Defects;
Toxic Chemicals
just split ['Agriculture; Sustainable Agriculture - Support; Organic
Agriculture; Pesticides, US, Childhood Development, Birth Defects;
Toxic Chemicals']
newstring = Antibiotics, Animals
just split ['Antibiotics, Animals']




More information about the Python-list mailing list