![](/img/trans.png)
[英]How to extract the text part only from an image using opencv and python?
[英]Given the path, how to extract only a part of it using python?
我有一个路径为 '/img/dataset/A/B/3/5/img1.png' 如何从中提取 '/A/B/3/5/img1.png' 部分?
我试过了path = '/img/dataset/A/B/3/5/img1.png'
extracted = path.partition('/')
这给了我作为 output 的整个路径。
这应该有效:
path[len('/img/dataset'):]
字符串与列表、索引和len
beeing 共享一些属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.