英文:
How to parse this data provided by python?
问题
我有一个用Python编写的程序 - [RedNotebook][1]。
它是一个现代的日记,以文本文件的形式保存在我的个人电脑上,格式如下:
$ cat ~/.rednotebook/data/2016-01.txt
给我类似于这样的内容:
10: {text: плов}
11: {text: '#переход
Легли около часа
Встали около 12 часов'}
12: {text: '{}
''
''
{
}
\''\'
{
}'}
<details>
<summary>英文:</summary>
I have program written in Python - [RedNotebook][1].
It is a modern journal being saved on my PC locally in text files with this format:
`$ cat ~/.rednotebook/data/2016-01.txt`
gives me something like this:
10: {text: плов}
11: {text: '#переход
Легли около часа
Встали около 12 часов'}
12: {text: '{}
''
''{
''}
\''
\{
\}'}
Note that format looks like json, but with single quotes `'` instead of double quotes, it has integers as primary keys(?) to indicate the day in month. And it escapes special characters by prepending `'` single quote.
So, my question is this:
**How does this format of data is called?**
Are there any libraries for parsing this format in Nodejs or Golang?
UPD1: i have found this post [How to merge two versions of RedNotebook][2]
They say -
> it's quite easy to mess up the YAML markup that is used in the month
> files, but RedNotebook will issue a warning when it sees such a file
> and you can fix it.
I'll try to parse it as yaml code
[1]: http://rednotebook.sourceforge.net/
[2]: https://answers.launchpad.net/rednotebook/+question/254990
</details>
# 答案1
**得分**: 1
这是YAML代码。
可以使用https://github.com/nodeca/js-yaml进行解析。
<details>
<summary>英文:</summary>
It turned to be the YAML code.
It can be parsed by https://github.com/nodeca/js-yaml
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论