Python Foundation One

Source: Internet
Author: User

This is the content of the December plan, beginning in January 2018 ~

If there is any mistake, please ask for it ~

Previous content

Http://www.cnblogs.com/yinghualuowu/p/7742663.html

Print usage

No matter what type you can output directly (data type will be in the next article)

Like what

1X=12 Print(x)3s="Hello World"4 Print(s)5list_a=[1,2,'a', []]6 Print(list_a)7dict_a={'a': 1,'b': 2}8 Print(dict_a)
1Hello world['a', [1, 2]]{'a' ' b ': 2}

Formatted output

Like printf, there's%d,%s.
Like what
1 s="hello"2 a=20183print("  %s%d" % (s,a))
Hello 2018
1pi=3.14159262 Print("%f"%PI)3 Print("%.3f"%PI)4num=1234567895 Print(num)6 Print("%10.3f"%PI)#field width 10, accuracy 3 num for comparison7 Print("%-10.3f"%PI)8 Print("%010.3f"%PI)#fill blanks with 0
3.1415933.142123456789     3.1423.142     000003.142

Print default line break

Oh, don't want to change the line ...

1  Print ")  

A variety of very lazy operation

Some operations on strings

1x="Hello"2y=" World"3 Print(x+y)#Stitching4 Print(x*2)5 Print(" A"+" the")6 Print(" A"* *)
Helloworldhellohello12341212

Arithmetic is also possible.

It's almost there.

Python Foundation One

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.