For processing the content of multiple CSV files, I have to filter several characters, most notably NULL values, from string-list-elements. For this I've tried several solutions from the web. One of them is the following function:
def removeNull(rawString):
l = filter("\u0000", list(rawString))
newString = ''.join(l)
printUtil.printAll(newString, "\n")
return newString
However, it always gives me TypeError: 'str' object is not callable, terminating the program. The more sophisticated solutions didn't gave me an error but they changed absolutely nothing and the NULL values where still in place.
Furthermore, if I exchange \u0000 by any other value but None (which results in no changes), I am getting the same error message.
Hopefully, someone can solve this for me for I am out of ideas after 4 or 5 hours of trial and error.
Thank you for your answers and suggestions!
Solving the problem:
The error message originated from the fact, that I used "\u0000" as argument for the build in filter-function. Two valid solutions to that particular problem focus on passing the necessary function:
l = filter(lambda x: x != '\u0000',rawString)
or
l = filter(lambda x:ord(x) != 0, list(rawString))