tf.io.gfile.join
Интеллектуально объединяет один или несколько компонентов пути.
tf.io.gfile.join(
path, *paths
)
Файловые системы, специфичные для TensorFlow, будут объединяться как URL (с использованием «/» в качестве разделителя пути) на всех платформах:
В Windows или Unix-подобных системах:
>>> tf.io.gfile.join("gcs://folder", "file.py")
'gcs://folder/file.py'
tf.io.gfile.join("ram://folder", "file.py")
'ram://folder/file.py'Но для собственной файловой системы объединение выполняется так же, как os.path.join:
path = tf.io.gfile.join("folder", "file.py")
if os.name == "nt":
expected = "folder\\file.py" # Windows
else:
expected = "folder/file.py" # Linux/Unix-like
path == expected
True| Аргументы | |
|---|---|
path | строка, путь к каталогу |
paths | строка, дополнительные пути для объединения |
| Возвращаемое значение | |
|---|---|
path | объединённый путь. |
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/io/gfile/join