MCPcopy Create free account
hub / github.com/omkarcloud/botasaurus / remove_after_first_slash

Function remove_after_first_slash

botasaurus_api/botasaurus_api/utils.py:4–19  ·  view source on GitHub ↗
(input_string)

Source from the content-addressed store, hash-verified

2from os import path, makedirs, getcwd
3
4def remove_after_first_slash(input_string):
5 i = 0
6 str_len = len(input_string)
7 while True:
8 if i < str_len:
9 char = input_string[i]
10 if char == "/":
11 if i+1 < len(input_string) and input_string[i+1] == "/":
12 i+=2
13 continue
14 else:
15 return input_string[0: i]
16 i+=1
17 else:
18 break
19 return input_string
20
21def relative_path(target_path, goback=0):
22 levels = [".."] * (goback + -1)

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected