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
Read More:
- [Solved] python tqdm raise RuntimeError(“cannot join current thread“) RuntimeError: cannot join current thr
- Python: How to Use try exception to Display Abnormal Error Information
- Python+OpenCV: How to Use Background Subtraction Methods
- [Solved] NPM install Error: check python checking for Python executable python2 in the PATH
- Python traverses all files under the specified path and retrieves them according to the time interval
- Python PIP TypeError: expected str, bytes or os.PathLike object, not int
- How to Solve Python WARNING: Ignoring invalid distribution -ip (e:\python\python_dowmload\lib\site-packages)
- [Solved] Linux OS python Script Error: smtplib has no attribute SMTP_SSL
- Python 3 uses the relative path import module
- MAC OS install python3 Error: Permission denied @ dir_s_mkdir-/usr/local/Frameworks
- Python: How to get the size of the picture (byte/kb/mb)
- Python Use PIP to install pyinstaller Error [Solved]
- Change the Python installation path in Pycharm
- Python: How to Set Line breaks and tabs for Strings
- An introduction to sys modules in Python and how packages are imported and used
- [Solved] python opencv Error: findContours() Can only use the Grayscale
- Python: How to Solve multiprocessing module Error in Windows
- Ab3dmot vehicle pedestrian recognition (How to Use)
- Python: How to Auto Add Watermark to PDF