0

I have read and re-read a handful of pages about PEP and literal stringinterpolation.
But still can't figure out through experimentation what exact syntax will work so i can remove the %s from following statement in my python script.

cmds.getAttr("%s.fileTextureName" %item, newPath,type="string")

Thanks~

Anil_M
  • 10,893
  • 6
  • 47
  • 74
lpt
  • 1

1 Answers1

1

Have you tried string.Formatter

cmds.getAttr("{}.fileTextureName".format(item), newPath,type="string")

The built-in str and unicode classes provide the ability to do complex variable substitutions and value formatting via the str.format() method described in PEP 3101.
The Formatter class in the string module allows you to create and customize your own string formatting behaviors using the same implementation as the built-in format() method.

Anil_M
  • 10,893
  • 6
  • 47
  • 74