punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~'''

# take input from the user
my_str = ("Enter a string sdsds, dgfd // sfs s. ")

# remove punctuation from the string
no_punct = ""
for char in my_str:
      if char not in punctuations:
              no_punct = no_punct + char

# display the unpunctuated string
print(no_punct)
Вывод результата:
Enter a string sdsds dgfd sfs s 

Оценка - 1.0 (7)

2015-11-29 • Просмотров [ 2785 ]