如何连接变量加上 os.enviorn 路径加上 Python 中的 yaml

How to concatenate variables plus os.enviorn path plus yaml in Python

1)TOPDIR =/../../

2)/ABC/path/

3)name=os.os.environ['ABC'].lower()

4).yaml

我想将所有四个东西连接成一个,例如

尝试了以下解决方案:

[TOPDIR + "/ABC/path/" + name .yaml] appending this in Generartor

不工作。任何人都可以为此提供解决方案。

TOPDIR = '/../../'
name = os.environ['ABC'].lower()
print([TOPDIR + "/ABC/PATH/" + name + '.yaml'])

这应该有效。 它实际上抛出的错误是什么? 也许你打错了“os.enviorn”应该是“os.environ”