0

Making a program to remove quotations from News Articles in order to count the number of occurrences for all words in article. News articles frequently feature words embedded in quotes. The quote at the end can be removed from the string using "\""

However I can't get the quotation mark at the start of the quote to be removed. I'm trying to remove quotes using list comprehension:

word_array_with_punctuation_removed=\ 
[i[:-1] if i[-1] in('". , ; ? ! : "\" "'.split() ) else i for i in array_of_words ]

I cannot get the front quote recognized within the in( ) statement

If my test string from user input was

"n  n , n"`

array_of_words should out put as :

[n , n , n]

However, when ran, the output is :

["n , n , n]

TL;DR: How can I remove front quotes embedded within strings?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

0 Answers0