mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-06 14:27:26 +08:00
Improve Python code for importing modules.
This commit is contained in:
@ -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):
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user