python 包与函数

2019-06-29  本文已影响0人  crunch114

pytorch permute函数

两列表对应元素相加形成新列表

a = [1, 2]
b = [3, 4]
c = [i + j for i, j in zip(a, b)]  # [4, 6]

Python使用import导入相对路径的其他py文件

https://www.cnblogs.com/zhuxiaoxi/p/10003609.html

image.png
#***获取当前目录***
import os
os.getcwd()
#***获取上级目录***
os.path.abspath(os.path.dirname(os.getcwd()))
#或者
#os.path.abspath(os.path.join(os.getcwd(), ".."))
#***获取上上级目录***
os.path.abspath(os.path.join(os.getcwd(), "../.."))
#***退到上级目录***
path=os.path.abspath(os.path.dirname(os.getcwd()))
os.chdir(path)
上一篇 下一篇

猜你喜欢

热点阅读