Getting Started with Python

Source: Internet
Author: User

Python

Concise syntax and support for dynamic input, combined with the nature of explanatory language, make it an ideal scripting language in many areas of most platforms, especially for fast application development features: Simple, easy to learn, free, open source, high-level language, portability, interpretive, object-oriented, extensible, Embeddable, Rich Library

Installation:

: https://www.python.org/downloads/-3.5\scripts\; C:\Program Files\python 3.5\;

Learn:
1 How to run the program:

 Two ways to run your program using Python-- Use the interactive prompt interpreter or use the source file 1 command line: Prthon , print    hello World   "---> (prompting you to add an environment variable already) -----Missing Parentheses in  call to  " print   " the statement above does  Span style= "color: #0000ff;" >not  work in  Python 3. In Python 3 need to add parentheses around the value of be printed: different versions, missing parentheses:  print  ( hello World   ' ) 

2 Integrated development Environment:

Click on the Ordered->python 3.5->idle (Python GUI)--- can be indented and written--run/f5

3 Data types

number: integers, long integers, floating-point numbers, and complex strings: "", \ ' , a single quote and a string inside a double quote, there is an escape character \ n the string is immutable, and the string prefix plus U is a unicode string: U' hehe '   Tip: There is no dedicated char data type, you can str[index] to get the regular expression operators that must be processed with natural strings: not and  or-----! && | |

4 small Get----------* *

1 Double-click the Python script to run, the result flashed: At the end of the script add: If it is python3 to use input, if it    is Python2 will use raw_input such as: Print      ('helloworld '3.5\hello.py3 Clear screen:    import  os Os.system ("cls") 4 Comments:#

Control flow

The biggest difference between learning Python and other languages is that Python's code block does not use curly braces ({}) to control classes, functions, and other logical judgments. Python's most distinctive feature is the use of indentation to write modules.  if ---elseif    --elsewhile condition for in         Loop Internal change   

Data:

tuples: A set of elements that do not modify the collection, c= (1,2,3,4,5) c1= (1,), C[index] to get elements of the value of the tuple's elements cannot modify tuples using parentheses, the list uses square brackets: Length: Len (c) Copy: C =[2]*100    Loop: for in C connection: C in (round) function:    max (c) min ( c)

- its position, or index, the first index is 0, the second index is the 1 list is the most commonly used Python data type, it can be used as a comma-separated value within a square bracket the data item that appears in the list does not need to be created with the same type: List=[1,2,' Me ', 3,4,'handsome'] gets: list[1]---2,    list[1:3] 2 me,--- Delete:  del list[3

Learn MORE:-----Python Introductory Tutorial

Getting Started with Python

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.