python - string formatting -


I can not find why the colon was released for the second time

  & gt; & Gt; & Gt; Print '% 5s'% ':': & gt; & Gt; & Gt; Print '% 5s'% ':' '% 2s'% ':' ::  

Help me with this

In Python, seismost strings are added:

  & gt; & Gt; & Gt; T = 'A' 'BCD' & gt; & Gt; & Gt; T 'ABCD'  

In its second example, it is equivalent:

  gt; & Gt; & Gt; According to the preference rules for the% operator of Python, this is:  
  '% 5' '%':% 2s'% ':'  

& Gt; & Gt; & Gt; Print ('% 5s'% ':% 2s')% ':'

or

  & gt; & Gt; & Gt; Print ':% 2s'% ':' ::  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -