没有项目描述
rustcsv的Python项目详细描述
内容
重大免责声明
- 这不是生产就绪库。
- 我不是一个生产准备锈程序员。
- python 3的^{tt2}$stdlib模块都很漂亮!&;快速或我的生锈代码 是%!&;慢。
安装
pip install rustcsv
示例
路径
中的csvreader实例importtempfilefromrustcsvimportCSVReader# Create a temporary file to put our CSV content in,# automatically delete it once we're done.withtempfile.NamedTemporaryFile(mode="w")aswritable_fd:writable_fd.write("""\ spam1,spam2,spam3 spam4,spam5,spam6 """)writable_fd.flush()forrow_number,rowinenumerate(CSVReader(writable_fd.name),start=1):print("row #{row_number}: {row}".format(row_number=row_number,row=row))# Prints:# row #1: ("spam1", "spam2", "spam3")# row #2: ("spam4", "spam5", "spam6")
来自二进制文件对象的csvreader实例
examples/reader_from_file_object.py:
importtempfilefromrustcsvimportCSVReader# Create a temporary file to put our CSV content in,# automatically delete it once we're done.withtempfile.NamedTemporaryFile(mode="w")aswritable_fd:writable_fd.write("""\ spam1,spam2,spam3 spam4,spam5,spam6 """)writable_fd.flush()readable_fd=open(writable_fd.name,"rb")forrow_number,rowinenumerate(CSVReader(readable_fd),start=1):print("row #{row_number}: {row}".format(row_number=row_number,row=row))# Prints:# row #1: ("spam1", "spam2", "spam3")# row #2: ("spam4", "spam5", "spam6")
开发
开发安装
从本地安装和构建扩展,例如git签出。
要求
- Pipenv。
- Python3.6。
- 每晚(1.30起)https://rustup.rs/。
安装python依赖项
pipenv install --dev
构建rustcsv._rustcsv扩展
或者
使用“调试”货物配置文件,或
make develop-debug
使用“释放”货物配置文件
make develop-release
运行测试
make test
运行基准
make benchmark
注意:make benchmark将始终使用“release”构建扩展 货物资料。