在python中写入文件 [英] writing to a file in python

查看:74
本文介绍了在python中写入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建目录,然后在该目录中为一年中的每一天创建一个文件,这样它们将被命名为0101,0102,依此类推。另外我需要做什么,所以我可以在每个文件中放入一些基本的html代码,让我们说现在我希望文件只有< html> <身体GT; < / HTML>在每年365天的每个文件中。有没有快速的方法在python中执行此操作

解决方案

展开 | 选择 | Wrap | 行号


展开 | 选择 | Wrap | 行号


展开 | 选择 | Wrap | 行号< /跨度>

How do I create a directory and then within that directory create a file for every day of the year so they will be named 0101, 0102 and so on. Also what do I need to do so I can put some basic html code in each file lets say for now I want the files to just have <html> <body> </html> in each file for the 365 days in the year. Is there a quick way in python to do this

解决方案

Expand|Select|Wrap|Line Numbers


Expand|Select|Wrap|Line Numbers


Expand|Select|Wrap|Line Numbers


这篇关于在python中写入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆