import restates = [' Alabama ', 'Georgia!', 'Georgia', 'georgia', 'FlOrIda','south carolina###', "West virginia?"]result1 = []def myFunc(x): return re.sub('[!#?]', '', x)funcs = [str.strip, str.title, myFunc]def resultFunc(need_change, after_change):''' need_change - list which one need to be changed after_change - result list''' for elements in need_change: for func in funcs: elements = func(elements) after_change.append(elements) return after_change result3 = []a = list(map(resultFunc, states, result3))
why this code return None?
But this work
import re states = [' Alabama ', 'Georgia!', 'Georgia', 'georgia', 'FlOrIda','south carolina###', "West virginia?"]result1 = []def myFunc(x): return re.sub('[!#?]', '', x)funcs = [str.strip, str.title, myFunc]def resultFunc(need_change, after_change):''' need_change - list which one need to be changed after_change - result list''' for elements in need_change: for func in funcs: elements = func(elements) after_change.append(elements) return after_change result3 = []resultFunc(states, result3)