I don't have much experience with python, so I hope you could help me.
I have to do a program that delete all the punctuations of a input txt document, but i can't figure out how to input the name(of the xy.txt) in the function.


import string
def punc(s):
    txt = open( ' s ', 'r').read() #s should be replaced with the name.txt

    for punct in string.punctuation:
        txt2 = txt.replace(punct,"")
    return txt2

Program where you are supposed to enter the name of the txt document, you have to clean of punctuations

import function

s=raw_input("Enter the name of the text document: ")

print a

I would be very grateful if somebody could help me.

You are close:

import string

def punc(s):
    txt = open(s, 'r').read()
    print(txt)  # for test only
    for punct in string.punctuation:
        if punct in txt:
            # update txt
            txt = txt.replace(punct, "")
    return txt

# test your potential function.py module
if __name__ == '__main__':
    # pick a text file you have in the working folder
    fname = "name.txt"
    new_text = punc(fname)
    # show the result return from the function punc()
"""my test display -->
Frank, Miller: III
Dr. August Jarr
Mrs. Lola Meyer-Lipstick

Frank Miller III
Dr August Jarr
Mrs Lola MeyerLipstick
This question has already been answered. Start a new discussion instead.