Creating files and directories via Python

前端 未结 2 891
面向向阳花
面向向阳花 2020-12-08 07:21

I\'m having trouble creating a directory and then opening/creating/writing into a file in the specified directory. The reason seems unclear to me. I\'m using os.mkdir() and

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-08 08:25

        import os
        os.mkdir('directory name') #### this command for creating directory
        os.mknod('file name') #### this for creating files
        os.system('touch filename') ###this is another method for creating file by using unix commands in os modules 
    

提交回复
热议问题