[Original] python for 3 days

Source: Internet
Author: User

Many of you are very interested in python. Although codecademy abroad is very fun to learn programming, many of you do not have the habit of reading English websites. all of you have the idea to write this article.

Before that, of course, I would like to declare that I still think ruby is more fun and I will write ruby later.

1. First say hello.

 

2. Write the variable.

mynum=12=

3. Write a function

 

Here we have to stop. The python statement block is represented by indentation, and there is a colon every time you want to indent it:

If you remember this, you will understand python in half.

4. write comments

 

5 string method

 len( lower( upper( str(123 int()

6. Add strings

 +

7. format the output

name= %name

% Percent is formatted output, replace % s with name

8. obtain user input.

name=raw_input( name

9 Control Process

   

10 import module

 threading

11 playlist

list=[1,2,3,4,56 list[1:3 list[:2 list[1 i  i

12 tuples

 (1,2,3)

13. Dictionary

d = { : 1,  : 2,  : 3}

14 play Loop

 for i in range(12):
  print i
for i in [1,2,3]:
  print i

15 legendary list Derivation

[i**2  i  range(12)  i%2==0]

16 categories

 ==Hymenz(

17 files

f=open(,f.close()

If you haven't played enough after reading this, contact your friend for a chat http://www.cnblogs.com/hymenz/archive/2013/05/27/3101347.html.

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.