I would like to print the all the words in the text file excluding the braces, parentheses, commas and "data:". How can I do it with re?
Desired output: aback abaft ......
import re
file = open("D:\Python\Exercises\Dictionary.txt","r")
dummy=file
for data in dummy:
if(wordlist != re.findall('"{data:"',data)):
print(data)
Below is the content in the text file {"data":["aback","abaft","abandoned","abashed","aberrant","abhorrent","abiding","abject","ablaze","able","abnormal","aboard","aboriginal","abortive","abounding","abrasive","abrupt","absent","absorbed","absorbing","abstracted","absurd","abundant","abusive","acceptable","accessible","accidental","accurate","acid","acidic"]}
It looks like you're reading in
json. Try this (if you always expect the data in the above form)