temporary-files - 在 mosel 中创建临时文件的惯用方法是什么?
问题描述
我正在寻找类似于 R/Python 中的 tempfile 函数的东西: https://docs.python.org/3/library/tempfile.html https://www.rdocumentation.org/packages/base/versions/3.6 .1/主题/临时文件
这在摩泽尔有吗?
解决方案
您可以使用 I/O 驱动程序“tmp:”在 Mosel 实例的临时目录中创建一个文件,可能结合函数“newmuid”创建一个唯一标识符作为文件名,例如:
tmpfname:="tmp:"+newmuid
fopen(tmpfname, F_OUTPUT)
writeln("This line is written into the temporary file")
fclose(F_OUTPUT)
推荐阅读
- python - Terraform: Validation error ... Member must satisfy regular expression pattern: arn:aws:iam::
- python-3.x - 如何计算字符串中单词或 word_group 的出现次数(短语)
- jquery - 使用 FileReader 上传多个文件
- go - go revel undefined: sql or Txn
- python - 在python中的列表中创建项目频率图
- matlab - 在 tar.gz 文件中读取 NetCDF 文件而不提取 tar 文件
- php - 我们如何将值分配给作为数组的模型对象键
- django - wsgi:alert 没有这样的文件或目录:mod_wsgi (pid=XXXX): 无法绑定 unix 域套接字'/usr/local/opt/httpd/logs/wsgi.xxxxx.11.1.sock'
- java - 使用 spock 生成测试中的对象列表
- node.js - 跨域请求被阻止:同源策略不允许在 https://localhost:3000/ 读取远程资源