In Python, I want to both (a) use the
CodePudding user response:
Problem solved. Even though I couldn't apply str.format
method to the output of yachalk
, I could apply the str.format
method first and then apply yachalk
.
from yachalk import chalk
s1 = "e4"
s2 = "c5"
s3 = "Nf3"
s = '{:8}'.format(s1) '{:8}'.format(s2) '{:8}'.format(s3)
c1 = chalk.yellow('{:8}'.format(s1))
c2 = chalk.yellow('{:8}'.format(s2))
c3 = chalk.yellow('{:8}'.format(s3))
c = c1 c2 c3
print(s)
print(c)
See output as pasted graphic: