Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to create an empty file in python

Shulou Source: shulou.com Published: 2022-05-31 11:12:39 09月23日 Update

This article introduces the knowledge of "how to create an empty file in python". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Specific operation methods:

1. Find the python program in the start menu of win system.

2. Find and open the idle tool program in the python program directory.

3. Click "File" in the upper left corner of the idle tool and select "New File" to create a new shell script.

4. Enter the following instructions in the shell script to import the os module.

Import os # Import os module

5. Finally, use the following instructions to create an empty file.

Os.mknod (path) # path refers to the file name

Related operation instructions:

Os.getcwd () # gets the current working directory

Os.path.getsize (file name) # View the size of the specified file

That's all for "how to create an empty file in python". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: File instruction program content tool file name more module directory knowledge script practical successful next dilemma size actual upper left corner situation article Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Technology Apple Redmi NVidia