In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces how to view all files in the specified directory in python, the content is detailed and easy to understand, the operation is simple and fast, and it has certain reference value. I believe that after reading this article on how to view all files in the specified directory in python, there will be gains. Let's take a look at it together.
Specific operation method:
1, in the win system start menu to find python program.
2. Find and open the idle utility program in the python program directory.
3. In the idle tool, click "File" in the upper left corner and select "New File" to create a shell script.
4. Import the os module by entering the following command in a shell script.
import os #import os module
5. Finally, view all files and directory names under the specified directory by the following instructions.
os.listdir(directory path) #Returns all file and directory names in the specified directory
Related operating instructions:
os.getcwd() #Get current working directory
os.path.getsize(filename) #View the size of the specified file
The content of this article on "how to view all files in the specified directory in python" is introduced here, thank you for reading! I believe everyone has a certain understanding of the knowledge of "how to view all files in the specified directory in python." If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.