add code
parent
039ec82c93
commit
be8ac2a728
|
|
@ -0,0 +1 @@
|
|||
.DS_Store
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import json
|
||||
from datetime import datetime
|
||||
txt = open('text.md', 'w', encoding='utf-8')
|
||||
for file in os.listdir("E:\code\keep"):
|
||||
if file.endswith(".json"):
|
||||
with open(file, 'r', encoding='utf-8') as f:
|
||||
text = json.load(f)
|
||||
print(file)
|
||||
if text['title'] != "":
|
||||
txt.write('**' + text['title'] + '**' + '\n')
|
||||
if 'textContent' in text:
|
||||
txt.write(text['textContent'] + '\n')
|
||||
if 'text' in text:
|
||||
txt.write(text['text'] + '\n')
|
||||
if 'labels' in text.keys():
|
||||
for i in text['labels']:
|
||||
txt.write('`' + i['name'] + '`' + '\n')
|
||||
ts = int(text['userEditedTimestampUsec'])//1000000
|
||||
t = datetime.utcfromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
|
||||
txt.write('`' + t + '`' + '\n\n---\n')
|
||||
Loading…
Reference in New Issue