gpt4 book ai didi

python - 玛雅 python : How do I get the scene name but not the path or extension

转载 作者:行者123 更新时间:2023-11-28 20:59:02 25 4
gpt4 key购买 nike

我只想获取当前打开文件的场景名称。不是路径或扩展名。

cmds.file(q=True, sn=True)

我不能使用上面的,因为它返回完整路径。

谢谢

最佳答案

os 模块包括用于此的实用程序:

 filepath = cmds.file(q=True, sn=True)
filename = os.path.basename(filepath)
raw_name, extension = os.path.splitext(filename)

关于python - 玛雅 python : How do I get the scene name but not the path or extension,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50506859/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com