转化Csv,excel到语言相关的文件
2015-08-09 19:30
489 查看
代码地址:https://github.com/neoliang/const-data
const-data is a free, open source tool, the target of this tool are:1.convert csv or excel to simple language specified data format.2.generate language speicfied reading codes
the first three rows are fixed
the first rows describes data which will be ignored in converting
the second row describes data name in this columnthe third row describes data type in this column: validate types are:
a. int
b. float
c. string
d. json
e. comment: the comment type of column will be ignored in converting
f. empty: the type of column of empty type will be intexamples:
a. the type of id-column is int because it's empty
1.the command line is almost same as convert csv excpe the option -if is excel2.you must install xlrd using pip as following:
const-data
const-data is a free, open source tool, the target of this tool are:1.convert csv or excel to simple language specified data format.2.generate language speicfied reading codes
csv
or excel format
the first three rows are fixedthe first rows describes data which will be ignored in converting
the second row describes data name in this columnthe third row describes data type in this column: validate types are:
a. int
b. float
c. string
d. json
e. comment: the comment type of column will be ignored in converting
f. empty: the type of column of empty type will be intexamples:
id | 触发类型 | 触发id | 奖励 | 备注 | 其它 |
---|---|---|---|---|---|
id | trigger_type | trigger_id | reward | comment | extra |
string | int | json | comment | float | |
1 | piece | 26 | {"yellow":2} | 泥土消除奖励 | 0 |
2 | piece | 27 | {"diamond:1} | 钻石消除奖励 | 10.5 |
converting
csv file to lua file
#convert one csv file #in root dir cd convert python ./convert.py -file ../testdata/reward.csv -out_dir ../testdata -if csv -of lua #convert csv files in dir python ./convert.py -dir ../testdata -out_dir ../testdata -if csv -of lua
converting
csv file to json file
#convert one csv file #in root dir cd convert python ./convert.py -file ../testdata/reward.csv -out_dir ../testdata -if csv -of json #convert csv files in dir python ./convert.py -dir ../testdata -out_dir ../testdata -if csv -of json
converting
excel to other files
1.the command line is almost same as convert csv excpe the option -if is excel2.you must install xlrd using pip as following:pip install xlrd
command
line usage:
usage: python ./convert.py -if input_format -of output_format -file input_file -out_dir lua_dir python ./convert_csv_to_lua.py -if input_format -of output_format -dir csv_dir -out_dir lua_dir options: -if: input file format : csv or excel -of: output file format lua,json -dir: convert files in dir -file: convert file -out_dir: the dir of output files -h print: this message
相关文章推荐
- 【HDU2196】【Computer】
- 【Java多线程】之十四:Java FutureTask Example Program
- maven学习(nexus的安装)
- Oracle完全卸载详解
- iOS开发概述 - 17.UIView动画和核心动画对比
- Zookeeper之创建组,加入组,列出组成员和删除组
- 【python3】相关资料库
- IQ调制、整形滤波器与星座映射
- PyQt5初级教程--PyQt5中的部件II[9/13]
- 1078. Hashing (25)
- iOS开发概述 - 16.CAAnimation(核心动画实例)
- 浅析CVE-2015-3636
- hbase通过row key 的前缀查询记录
- 1078. Hashing (25)
- 安装后维修指南再次双系统xp、win7、ubuntu
- 【Cocos2d入门教程三】HelloWorld之一目了然
- 递归调用2
- 常见错误及解决方式
- 串口使用
- 智渔课堂官方免费教程三:Java基础之注释 关键字 标识符