First, in your intro you say you want to remove all strings of the form "f=n;" where n can be 0-14. So you want to remove "f=0;" and "f=1;" and ... Later, you appear to be trying to remove "f=;" which may be what you want but it doesn't match your described intentions.
Second, the formatting (whitespace) is all messed up on your post (at least in googroups), so its not entirely clear what the program is supposed to do. Anyway, why do you say the program doesn't work? Does it generate an error when you try to run it? Or is it doing what you say and not what you mean? I'm guessing that it will give (provided it doesn't end on a SyntaxError) at least the following error: TypeError: replace() takes at least 2 arguments (1 given) This is because the line: data = data.replace(x) doesn't use enough arguments for the replace() method. You need to say what to replace it with. Since you want to remove whatever string it is, you can use the empty string as the replacement value: data = data.replace(x, '') #That's two single quotes Also, unless you want to make a regular expression, you might have to do a replace() call on data 15 times, sort of like this: for i in range(15): text_to_remove = "f=%s;" % i data = data.replace(text_to_remove, '') -- http://mail.python.org/mailman/listinfo/python-list