Python: How to write a function to capitalize the name and change it to the following--dictionary with three quotation marks

Source: Internet
Author: User

Example: python: How do I write a function that capitalizes a name and becomes the following?


Dictionaries + lists: Each letter is in a list of dictionaries, divided six times to print out:

DIC = {}dic[' c ']=['  CCCC ', ' C    c ', ' C      ', ' C      ', ' C    c ', '  CCCC ']dic[' a ']=['     a     ', '    a '    ','   A   ', '  aaaaaaa  ', ' a       a ', ' a         ']dic[' t ']=[' ttttttt ', ' t ',   '   t   ', '   t   ', '   t   ', '   t   ']dic[' r ']=[' rrrrr  ', ' r r    ', ' R    R ', ' Rrrrr  ', ' R    R ', ' r r     ']dic[' e ']=[' eeeeee ', ' e     ', ' eeee  ', ' e     ', ' e     ', ' eeeeee ']for count in range (6 ): Print dic[' C '][count],print dic[' A '][count],print dic[' T '][count],print dic[' E '][count],print dic[' R '][count]

Error attempt: If you consider Carter five characters as four key-value pairs and enclose them in a dictionary with three quotes, you can only output one column vertically. The code is as follows:

DIC = {}dic[' c ']= ' '  CCCC c    CCC c    C  CCCC ' ' dic[' a ']= ' a A a ' a   aaaaaaa  ' A       a A         A ' dic[' t ']= ' ttttttt t t t t   t   ' dic[' R ']= ' ' rrrrrr    rr    rrrrrrr    RR     
This code prints out the result isCater this is caused by a newline character that is output in three quotes.

Copyright NOTICE: Welcome reprint, Reprint please indicate the source http://blog.csdn.net/ztf312/

Python: How to write a function to capitalize the name and change it to the following--dictionary with three quotation marks

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.