Tag Archives: Python os.path.join()

Python: How to Use os.path.join()

os.path.join() is often used to read path splicing operations.

import os
import cv2

a='D:\\download'  #  Note the double slash, if not spliced address, you can use r' ', quotation marks available single slash, but with the splicing operation, I will only use the double slash at present
b='dog.jpg'
path=os.path.join(a,b) 
img = cv2.imread(path)
print(img)
# D:\download\dog.jpg