Python Basic Learning (1th day)

Source: Internet
Author: User

Write this essay, is to see Vamei big capital of the Python Quick Tutorial study notes, with this encourage each other, link: http://www.cnblogs.com/vamei/archive/2012/09/13/2682778.html

"First Lesson"

1, use Python to write a HelloWorld small program, directly in the hello.py input

print ' Hello World '

2. Hello.py can also be written as an executable script, as follows:

# !/usr/bin/env python Print ' Hello World '

You also need to give executable permissions to the above code, as follows:

#chmod 755 hello.py

Command line execution:

#./hello.py

Lesson two basic data types

1. Variables do not need to be defined

A=10print aprint Type (a) output: 10<type ' int ' >

Type (): Built-in function that queries the type of the variable.

2. Recycle variable name

If you want a to store a different value, you do not have to delete A to assign a value directly to it.

A=1.5print A,type (a) output 1.5,<type, ' float ' >

Print can be followed by multiple outputs, separated by commas.

3. Basic Data Type

Integer, Float, Boolean (True/false), String (single and double quotes are available)

Python Basic Learning (1th day)

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.