python - 使用for循环构建文件名并保存
问题描述
for i in range(1,151):
Path = './Result/Normal_%d'%i
Normal_i.to_csv(Path, sep=',' , header=None , index=None)
我想使用 for 循环来保存一个名为 Normal_1, Normal_2 ...Normal_150 的文件,我发现在 for 循环中使用“Normal_i”会出错。如何在 for 循环中保存名为 Normal_1、Normal_2 的文件?
解决方案
Path = './Result/Normal'
for i in range(1,151):
Normal_i.to_csv(Path+str(i), sep=',' , header=None , index=None)
推荐阅读
- c - 调用外部接口时使用静态数组
- c++ - 为什么对齐限制会在矢量化时改变 clang 的行为?
- odoo - odoo 14如何实现基于记录的访问控制?
- javascript - 如何从具有 2 万个元素的数组中过滤自动完成数据?
- python-3.x - 如何运行返回变量的线程函数?
- java - Kafka 资源泄露
- kubernetes - 使用 Kubernetes 运行的服务的 API 网关?
- c - stat() 函数的最大文件名长度是否与操作系统接受的不同?
- google-apps-script - 为什么这个 getLastRow 语句不起作用?
- botium-box - 运行 botium-cli (Botium) 时出现 readscript 错误