* R (Chandra) Chandrasekhar:
width = 5
height = 30
colors = ['#abcdef]', '#456789']
filename = "/tmp/image.png"
# I want to get the equivalent of variable interpolation in Perl
# so that the command
#
# convert -size 5x30 gradient:#abcdef-#456789 /tmp/image.png
#
# is derived from the variables above
Assuming that the extra right square bracket in 'colors' is a typo, here's one
way:
s = "convert -size {w}x{h} gradient:{g1}-{g2} {f}".format(
w = width, h = height, g1 = colors[0], g2 = colors[1], f = filename
)
Cheers & hth.,
- ALf
--
http://mail.python.org/mailman/listinfo/python-list