Forum: Poser Python Scripting


Subject: Useful Code Snippets

structure opened this issue on Jun 27, 2019 ยท 94 posts


adp001 posted Sat, 05 December 2020 at 4:37 PM

In real life I assume no extension is more than 5 characters (not where it matters for my scripts). So I simply use:


if "." in path[-5:]...

or as a function:

hasext = lambda path: "." in path[-5:]

I assume this is the faster possible form and fine for 99.9% of cases a script has to handle files.