Possible Duplicate:
Python Regular expression must strip whitespace except between quotes
I need to remove all whitespaces in a file that are not inside single or double quotes (i.e. not in a string).
I've found this solution Python Regular expression must strip whitespace except between quotes
but that works only for double quotes