0

I'm aware of the this solution and this solution when using string concatenator +. However I couldn't find how to do it with the new printing style (more details here), e.g. print '{:10s}'.format(str).

Community
  • 1
  • 1
tnabdb
  • 517
  • 2
  • 8
  • 22
  • @khelwood it is not. – tnabdb Aug 03 '16 at 10:05
  • When you tried to use the solutions given in those other questions (via `.format` if that's what you want), what code did you try, and what problems did you encounter? – khelwood Aug 03 '16 at 10:08
  • But i see it as different question, here the question very specific and wants to know how to make text bold in DOCUMENT string i.e """ document text """ or ''' document text ''' The given url points to a question to make the text bold in console which is using print!!! is it not!?? – varra Aug 03 '17 at 12:38

1 Answers1

5

The same ANSI escape sequences work just fine.

print('\033[1m{:10s}\033[0m'.format('foo'))
AKX
  • 152,115
  • 15
  • 115
  • 172