[PYTHON] Zeichen in voller Breite + Zeichen in halber Breite drucken

print_moji.py


#!/usr/bin/python
# -*- encoding: utf-8 -*-

print '-' * 60
print '#Zeichen halber Breite'
print '| %%20s|%20s| %%20s|%20s|' % ('UTF-8','Unicode')
print '| %%20s|%20s| %%20s|%20s|' % ('-' * 20,'-' * 20)
print '| %%20s|%20s| %%20s|%20s|' % ('1'                    , u'1'                   )
print '| %%20s|%20s| %%20s|%20s|' % ('12'                   , u'12'                  )
print '| %%20s|%20s| %%20s|%20s|' % ('123'                  , u'123'                 )
print '| %%20s|%20s| %%20s|%20s|' % ('1234'                 , u'1234'                )
print '| %%20s|%20s| %%20s|%20s|' % ('12345'                , u'12345'               )
print '| %%20s|%20s| %%20s|%20s|' % ('123456'               , u'123456'              )
print '| %%20s|%20s| %%20s|%20s|' % ('1234567'              , u'1234567'             )
print '| %%20s|%20s| %%20s|%20s|' % ('12345678'             , u'12345678'            )
print '| %%20s|%20s| %%20s|%20s|' % ('123456789'            , u'123456789'           )
print '| %%20s|%20s| %%20s|%20s|' % ('1234567890'           , u'1234567890'          )
print '| %%20s|%20s| %%20s|%20s|' % ('12345678901'          , u'12345678901'         )
print '| %%20s|%20s| %%20s|%20s|' % ('123456789012345'      , u'123456789012345'     )
print '| %%20s|%20s| %%20s|%20s|' % ('12345678901234567890' , u'12345678901234567890')
print '-' * 60
print '#Doppelbytezeichen'
print '-'* 60
print '| %%20s|%20s| %%20s|%20s|' % ('12345678901234567890' , u'12345678901234567890')
print '-'* 60
print '| %%21s|%(moji)21s| %%20s|%(moji)20s|' % {'moji':'1'}
print '| %%22s|%(moji)22s| %%20s|%(moji)20s|' % {'moji':'12'}
print '| %%23s|%(moji)23s| %%20s|%(moji)20s|' % {'moji':'123'}
print '| %%24s|%(moji)24s| %%20s|%(moji)20s|' % {'moji':'1234'}
print '| %%25s|%(moji)25s| %%20s|%(moji)20s|' % {'moji':'12345'}
print '| %%26s|%(moji)26s| %%20s|%(moji)20s|' % {'moji':'123456'}
print '| %%27s|%(moji)27s| %%20s|%(moji)20s|' % {'moji':'1234567'}
print '| %%28s|%(moji)28s| %%20s|%(moji)20s|' % {'moji':'12345678'}
print '| %%29s|%(moji)29s| %%20s|%(moji)20s|' % {'moji':'123456789'}
print '| %%30s|%(moji)30s| %%20s|%(moji)20s|' % {'moji':'1234567890'}
print '-'* 60
print '#Doppelbytezeichen(Unicode-Zeichenfolge)'
print '-'* 60
print '| %%20s|%20s| %%20s|%20s|' % ('12345678901234567890' , u'12345678901234567890')
print '-'* 60
print '| %%19s|%(moji)19s| %%20s|%(moji)20s|' % {'moji':u'1'}
print '| %%18s|%(moji)18s| %%20s|%(moji)20s|' % {'moji':u'12'}
print '| %%17s|%(moji)17s| %%20s|%(moji)20s|' % {'moji':u'123'}
print '| %%16s|%(moji)16s| %%20s|%(moji)20s|' % {'moji':u'1234'}
print '| %%15s|%(moji)15s| %%20s|%(moji)20s|' % {'moji':u'12345'}
print '| %%14s|%(moji)14s| %%20s|%(moji)20s|' % {'moji':u'123456'}
print '| %%13s|%(moji)13s| %%20s|%(moji)20s|' % {'moji':u'1234567'}
print '| %%12s|%(moji)12s| %%20s|%(moji)20s|' % {'moji':u'12345678'}
print '| %%11s|%(moji)11s| %%20s|%(moji)20s|' % {'moji':u'123456789'}
print '| %%10s|%(moji)10s| %%20s|%(moji)20s|' % {'moji':u'1234567890'}
print '-'* 60
print '#Zeichen voller Breite + Zeichen halber Breite'
print '-'* 60
print '| %%20s|%20s| %%20s|%20s|' % ('12345678901234567890' , u'12345678901234567890')
print '-'* 60
print '| %%21s|%(moji)21s| %%20s|%(moji)20s|' % {'moji':'1234567890123456789'}
print '| %%22s|%(moji)22s| %%20s|%(moji)20s|' % {'moji':'123456789012345678'}
print '| %%23s|%(moji)23s| %%20s|%(moji)20s|' % {'moji':'12345678901234567'}
print '| %%24s|%(moji)24s| %%20s|%(moji)20s|' % {'moji':'1234567890123456'}
print '| %%25s|%(moji)25s| %%20s|%(moji)20s|' % {'moji':'123456789012345'}
print '| %%26s|%(moji)26s| %%20s|%(moji)20s|' % {'moji':'12345678901234'}
print '| %%27s|%(moji)27s| %%20s|%(moji)20s|' % {'moji':'1234567890123'}
print '| %%28s|%(moji)28s| %%20s|%(moji)20s|' % {'moji':'123456789012'}
print '| %%29s|%(moji)29s| %%20s|%(moji)20s|' % {'moji':'12345678901'}
print '| %%30s|%(moji)30s| %%20s|%(moji)20s|' % {'moji':'1234567890'}
print '-'* 60
print '#Zeichen voller Breite + Zeichen halber Breite(Unicode-Zeichenfolge)'
print '-'* 60
print '| %%20s|%20s| %%20s|%20s|' % ('12345678901234567890' , u'12345678901234567890')
print '-'* 60
print '| %%19s|%(moji)19s| %%20s|%(moji)20s|' % {'moji':u'1234567890123456789'}
print '| %%18s|%(moji)18s| %%20s|%(moji)20s|' % {'moji':u'123456789012345678'}
print '| %%17s|%(moji)17s| %%20s|%(moji)20s|' % {'moji':u'12345678901234567'}
print '| %%16s|%(moji)16s| %%20s|%(moji)20s|' % {'moji':u'1234567890123456'}
print '| %%15s|%(moji)15s| %%20s|%(moji)20s|' % {'moji':u'123456789012345'}
print '| %%14s|%(moji)14s| %%20s|%(moji)20s|' % {'moji':u'12345678901234'}
print '| %%13s|%(moji)13s| %%20s|%(moji)20s|' % {'moji':u'1234567890123'}
print '| %%12s|%(moji)12s| %%20s|%(moji)20s|' % {'moji':u'123456789012'}
print '| %%11s|%(moji)11s| %%20s|%(moji)20s|' % {'moji':u'12345678901'}
print '| %%10s|%(moji)10s| %%20s|%(moji)20s|' % {'moji':u'1234567890'}

Ergebnis

------------------------------------------------------------
#Zeichen halber Breite
| %20s|               UTF-8| %20s|             Unicode|
| %20s|--------------------| %20s|--------------------|
| %20s|                   1| %20s|                   1|
| %20s|                  12| %20s|                  12|
| %20s|                 123| %20s|                 123|
| %20s|                1234| %20s|                1234|
| %20s|               12345| %20s|               12345|
| %20s|              123456| %20s|              123456|
| %20s|             1234567| %20s|             1234567|
| %20s|            12345678| %20s|            12345678|
| %20s|           123456789| %20s|           123456789|
| %20s|          1234567890| %20s|          1234567890|
| %20s|         12345678901| %20s|         12345678901|
| %20s|     123456789012345| %20s|     123456789012345|
| %20s|12345678901234567890| %20s|12345678901234567890|
------------------------------------------------------------
#Doppelbytezeichen
------------------------------------------------------------
| %20s|12345678901234567890| %20s|12345678901234567890|
------------------------------------------------------------
| %21s|                  1| %20s|                 1|
| %22s|                12| %20s|              12|
| %23s|              123| %20s|           123|
| %24s|            1234| %20s|        1234|
| %25s|          12345| %20s|     12345|
| %26s|        123456| %20s|  123456|
| %27s|      1234567| %20s|1234567|
| %28s|    12345678| %20s|12345678|
| %29s|  123456789| %20s|123456789|
| %30s|1234567890| %20s|1234567890|
------------------------------------------------------------
#Doppelbytezeichen(Unicode-Zeichenfolge)
------------------------------------------------------------
| %20s|12345678901234567890| %20s|12345678901234567890|
------------------------------------------------------------
| %19s|                  1| %20s|                   1|
| %18s|                12| %20s|                  12|
| %17s|              123| %20s|                 123|
| %16s|            1234| %20s|                1234|
| %15s|          12345| %20s|               12345|
| %14s|        123456| %20s|              123456|
| %13s|      1234567| %20s|             1234567|
| %12s|    12345678| %20s|            12345678|
| %11s|  123456789| %20s|           123456789|
| %10s|1234567890| %20s|          1234567890|
------------------------------------------------------------
#Zeichen voller Breite + Zeichen halber Breite
------------------------------------------------------------
| %20s|12345678901234567890| %20s|12345678901234567890|
------------------------------------------------------------
| %21s|1234567890123456789| %20s|1234567890123456789|
| %22s|123456789012345678| %20s|123456789012345678|
| %23s|12345678901234567| %20s|12345678901234567|
| %24s|1234567890123456| %20s|1234567890123456|
| %25s|123456789012345| %20s|123456789012345|
| %26s|12345678901234| %20s|12345678901234|
| %27s|1234567890123| %20s|1234567890123|
| %28s|123456789012| %20s|123456789012|
| %29s|12345678901| %20s|12345678901|
| %30s|1234567890| %20s|1234567890|
------------------------------------------------------------
#Zeichen voller Breite + Zeichen halber Breite(Unicode-Zeichenfolge)
------------------------------------------------------------
| %20s|12345678901234567890| %20s|12345678901234567890|
------------------------------------------------------------
| %19s|1234567890123456789| %20s| 1234567890123456789|
| %18s|123456789012345678| %20s|  123456789012345678|
| %17s|12345678901234567| %20s|   12345678901234567|
| %16s|1234567890123456| %20s|    1234567890123456|
| %15s|123456789012345| %20s|     123456789012345|
| %14s|12345678901234| %20s|      12345678901234|
| %13s|1234567890123| %20s|       1234567890123|
| %12s|123456789012| %20s|        123456789012|
| %11s|12345678901| %20s|         12345678901|
| %10s|1234567890| %20s|          1234567890|

Recommended Posts

Zeichen in voller Breite + Zeichen in halber Breite drucken