I am new in Jython.. I want to use the string formatting str.format()
in Jython ( look here ).
If I try to use it like this:
testText = 'This is a {word}'
and later on
str.format(testText, word='test!')
the exception text is:
Error: exceptions.AttributeError instance of 'org.python.core.PyReflectedFunction' has no attribute 'format'
What do I have to add in the imports/classpath or anywhere?!
Thanks for your help!!
Kind regards
尝试这个:
print "%(map_1)s %(map_2)s" % {'map_1':'Hello','map_2':'World'}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.