I am using ScraPy to get some information from a site and am getting a string back that looks like this:
[u'Oxfam-America Inc. \n ']
What I need is to get just the "Oxfam-America Inc." part back. Suggestions?
>>> [u'Oxfam-America Inc. \n '][0].strip()
u'Oxfam-America Inc.'
The method you want is .strip(). The problem is compounded because what you are getting back is a list, not a string, so you have to first access the 0th element in the list, then call the .strip() method on that string.
So for example if the variable assigned to the list you showed in the question were assigned to field you could print it with the following..
field = [u'Oxfam-America Inc. \n ']
stripped_text = field[0].strip()
print stripped_text