How to open a folder in python

藏色散人
Release: 2019-10-15 11:11:05
Original
11181 people have browsed it

How to open a folder in python

How to open a folder in python?

Use the following command

import os
os.system('explorer.exe /n, 文件夹路径')
Copy after login

This way you can open it directly. To open a file, I don’t know if you want to read it in the program or open the file directly. To open the file, use

os.system('cmd /c 文件名')
Copy after login

To use the file content in the script, use the open function to read the file content.

Related recommendations: "Python Tutorial"

The above is the detailed content of How to open a folder in python. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template