replace使わなかった件。
ref = open(“project_twitter_data.csv”, “r”)
ref = open(“positive_words.txt”, “r”)
ref = open(“negative_words.txt”, “r”)
punctuation_chars = [“‘”, ‘”‘, “,”, “.”, “!”, “:”, “;”, ‘#’, ‘@’]
def strip_punctuation(string):
new_string = “”
for i in string:
if i not in punctuation_chars:
new_string = new_string + str(i)
print(new_string)
return new_string
string = “‘ajkn#g@m!.,:.as:”
result = strip_punctuation(string)
print(result)
コメント