python format string remove spaces underscore code example Example: python replace space with underscore mystring.replace(" ", "_")