Hi I need to remove characters such as ?.'"[] from a text file and replace it with a white space " "
the file i need this done to is called mispel.txt i have also split the file into words and lowercase so far this what i have but last part not working

import sys
import string
infile = open('mispel.txt', 'r') 
infile2 = open('corspel.txt', 'r').read()
words = set(open('mispel.txt').read().lower().split())
words_cor = set(open('corspel.txt').read().split())
def pun(words):
    for ch in 'mispel.txt'.punctuation:
        words = words.replace("'!{-[?.]'", " ")
print words

Ouch! You may want to read up on the basics and use a few test prints.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.