Save the picture

Import cv2 cv2.imwrite('D:\\1.png', img_s) # img is the image you want to saveCopy the code

Open folder

Start Explorer #os.system("start Explorer %s" % folder) Through startfile OS. Startfile (folder)Copy the code

Select file open

  import cv2
  import numpy as np
  import tkinter as tk
  from tkinter import filedialog
   root = tk.Tk()
    root.withdraw()
    picture_1 = filedialog.askopenfilename()
    img = cv2.imread(picture_1)

Copy the code

Folder creation

Makedirs ('./dict_phone/', exist_ok=True) # Create folder os.makedirs('.. /dict_phone/', exist_ok=True)Copy the code

File copy

Import shutil # parameter Old path: new path shutil.copy('.. /dict_phone/test.json','.. /dict_phone_move/') # copy the test.json file from dict_phone to dict_phone_moveCopy the code

File movement (clipping)

Import shutil # parameter Old path: new path shutil.move('.. /dict_phone/test.json','.. /dict_phone_move/') # move (cut) the test.json file from dict_phone to dict_phone_moveCopy the code

File renaming

Rename ('test.txt','retest.txt') # rename the test. TXT file in the same directory to retest.txtCopy the code

File deletion

Import OS # parameter Old path: new path os.remove('.. /dict_phone/test.json') # delete test.json file from dict_phone folderCopy the code

subsequent

= = = = =

If you want to know more about the Internet of things and smart home projects, you can pay attention to my project practice column.

Or follow the public account.

Writing is not easy, thank you for your support.

This article uses the article synchronization assistant to synchronize