【问题标题】:How to read/write .xpt file with Python? [closed]如何用 Python 读/写 .xpt 文件? [关闭]
【发布时间】:2017-12-06 06:46:10
【问题描述】:

我是 Python 新手,正在寻找使用 Python 读取/写入 xpt 文件(SAS 数据集)的解决方案。

我从link 了解了使用 Python 的可能性。但是代码没有按预期工作。此代码中缺少的任何内容,无论是包含任何库还是安装任何库。甚至这段代码中的任何语法错误。

with open('example.xpt', 'rb') as f:
for row in xport.Reader(f):
    print row

注意:熟悉 PHP 脚本。

请帮助我找到合适的解决方案。

【问题讨论】:

  • 执行时没有收到任何错误吗?

标签: python sas


【解决方案1】:

需要导入包才能使用xport

Import xport

并且必须通过安装包

sudo pip install xport

【讨论】:

  • 谢谢。它的工作
猜你喜欢
  • 2022-01-24
  • 1970-01-01
  • 2013-05-23
  • 1970-01-01
  • 2011-12-04
  • 2022-01-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多