if string in python list replace underscore code example Example: space to underscore python mystring.replace(" ", "_")