[Python]A small parser
If you ask me what an engineer does? Writing C++? Writing Java? Writing Python?
I’ll say an engineer is who can solve the question in front of herself/himself.
And recently, I face a challenge that I need to parse a long long word file table into my customized JSON file.
SO, it looks reasonable to write some python to help me deal with this problem.
Input：A long long word file table.
Output：A customized JSON file.
And the best way for python to access the table data would be excel, so my first step is to paste the table to the excel and clean the unnecessary part(like some duplicate title etc.)
These two imports for accessing excel file:
These two for JSON format:
And this one is because I need to deal with some Latin language, so I’m gonna need this to assign the decoding and encoding:
Usage of Collection：
len() & zfill()：Can help you to fill some 0’s with specific lengh
The encoding for Latin words：