Spaces:
Running
on
Zero
Running
on
Zero
| def get_path_after_pexel(path_str): | |
| # 查找'pexel'第一次出现的位置 | |
| pexel_index = path_str.find('pexel') | |
| if pexel_index == -1: | |
| # 如果没有找到'pexel',返回空字符串或根据需求处理 | |
| return "" | |
| # 从'pexel'出现的位置之后开始查找第一个'/' | |
| slash_index = path_str.find('/', pexel_index) | |
| if slash_index == -1: | |
| # 如果在'pexel'之后没有找到'/',返回空字符串或根据需求处理 | |
| return "" | |
| # 返回'/'后面的部分 | |
| return path_str[slash_index + 1:] | |
| # # 测试示例 | |
| # test_path = "/robby/share/Editing/qingyan/data/pexels-video-msl-human10w-101frames/social/interview/5971451_cottonbro_studio.mp4" | |
| # print(get_path_after_pexels(test_path)) # 输出: social/interview/5971451_cottonbro_studio.mp4 |