0 Basic Science Python (iii)

Source: Internet
Author: User

Python i data types have integers, floating-point numbers, strings, Boolean, and null.


Don't dwell on what their specific data type is, first you need to understand what the dynamic language is. What is the characteristic of Python?

In Java, you might write this code int a = 10; And then you're typing a= "la la la la" is that OK. Of course not.

The compiler will tell you not to assign a string to a shape variable, whereas in Python the variable is on the left side of the equals sign without declaring the type.

The format is a case in English, or a number and an underscore. But remember, you can't start with numbers.

It's also important to understand that dynamic languages are assigned to variables in memory, you know. In Python you want to create an assignment code

Like a= ' I'm so Handsome '

First, the Python interpreter creates a "I'm really cute" string in memory and then wears a variable a in memory.

And pointed him to "I'm really handsome".

Okay, so I'm going to need to get this topic out.

A= ' first time '

B=a

A= ' second time '

Excuse me, is it the first time or the second time to enter B?

The answer is for the first time, why? Because you need to remember that the interpreter is talking about how to handle variables.

When a assigns a value to B, it simply refers to the "first time" and when assigning a value to a, only the reference changes,

B still points to the first time.


Here, the string is underlined, and the string can be in ' and ', but how do you represent it in a string---> ""

Here Python if you want to output a particular character, you need to escape, it is in front of the special symbol plus \ such as---> "\" "

So you can type a two-point string.

If you find it particularly troublesome to add the R keyword before the declaration character, this means that a string may have an escape character.

R '.....

But if you want to represent multiple lines of string, you can use the ' ... ' Yes, that's three points.

The Python annotation starts with the # symbol and notes a line. In other words, the behavior is calculated as a unit similar to//in Java



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.