18 lines
261 B
Python
18 lines
261 B
Python
import json
|
|
|
|
with open('comments.txt') as fp:
|
|
data = fp.read()
|
|
|
|
comments = data.split('\n\n')
|
|
|
|
print(len(comments))
|
|
|
|
data = {
|
|
'comments': comments
|
|
}
|
|
|
|
with open('comments.json', 'w', encoding="utf-8") as fp:
|
|
json.dump(data, fp, ensure_ascii=False)
|
|
|
|
|