The problem is that there are several different sets of characters I want to remove. So I created a tuple, but I can't find a way to get str.replace() to iterate through it.
I've tried the following.
the vars are as follows:
Replace is the whitespace character I want to convert the other characters too.
Remove is a tuple containing the character sequences I want to remove.
Test is a string with the file data.
map(test.replace,remove) #TypeError: too few arguments map(test.replace,remove, replace) #ditto: expected a character buffer object test.replace(remove, " ") #ditto:ditto map(test.replace(remove," "),range(len(remove))) #ditto:ditto map(replace(remove," "),test) #Strings object is not callable
I'm using " " as my replace char mainly to check if the function had worked.
So, anyone care to point me in the right direction on str.replace() or explain why str.strip() is doing nothing?
Thanks

New Topic/Question
Reply




MultiQuote




|