将 IronPython 文件对象转换为 .NET Stream 对象
有没有一种简单的方法可以将 IronPython 文件类对象转换为 .NET Stream?在 IronPython 中可以使用如下代码完成相反的操作:
net_stream = File.OpenRead('file.txt')
python_file = file(net_stream)
是否有一种简单的方法将其转换回来?或者您是否必须编写一个从 Stream
继承并实现所有方法的包装器?
Is there an easy way to convert an IronPython file-like object to a .NET Stream? The reverse can be done in IronPython using code like this:
net_stream = File.OpenRead('file.txt')
python_file = file(net_stream)
Is there an easy way to convert it back? Or do you have to write a wrapper that will inherit from Stream
and implement all the methods?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然可以这样做:
apparently it's possible to do it like this: