Improve Python code for importing modules.

This commit is contained in:
krahets
2023-10-19 16:21:51 +08:00
parent 1e49574332
commit 5aacf2dfe0
32 changed files with 114 additions and 95 deletions

View File

@ -4,10 +4,11 @@ Created Time: 2022-11-25
Author: Krahets (krahets@163.com)
"""
import sys, os.path as osp
import sys
from pathlib import Path
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))
from modules import *
sys.path.append(str(Path(__file__).parent.parent))
from modules import ListNode, print_linked_list
def insert(n0: ListNode, P: ListNode):

View File

@ -43,7 +43,7 @@ if __name__ == "__main__":
for i in range(len(nums)):
tmp.append(nums[i])
print(f"\n通过索引遍历列表得到 tmp = {tmp}")
tmp.clear()
for num in nums:
tmp.append(num)