Skip to content

Commit 0663d19

Browse files
committed
import pathlib
1 parent 43bc11c commit 0663d19

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

binary_search/binary_search.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
# Created by imoyao at 2019/5/13 18:33
4-
import os
4+
5+
import pathlib
56
import sys
67

7-
try:
8-
from ..util import utils
9-
except ValueError:
10-
currpath = os.path.join(os.getcwd(), os.path.dirname(__file__))
11-
relative_fp = os.path.dirname(currpath)
12-
print(relative_fp)
13-
sys.path.append(relative_fp)
14-
from util import utils
8+
util_p = pathlib.Path('..').resolve()
9+
sys.path.append(str(util_p))
10+
11+
from util import utils
1512

1613

1714
@utils.show_time

0 commit comments

Comments
 (0)