Introduction to using variables and character constants in Python objects

Source: Internet
Author: User

The following articles describe the concept of a Python object and introduce the Code related to the use of variables and character constants in a Python object. The following describes the content of this article, I hope you will gain some benefits after reading the following articles.

Python tends to call everything an object.

Example: Use variables and character constants

 
 
  1. #Filename:Var.py  
  2. i=5 
  3. print(i)  
  4. ii=i+1  
  5. print(i)  
  6. s='''This is a multi-line string.  
  7. This is the seconde line.'''  
  8. print(s)   

Output:

 
 
  1. 5  
  2. 6  
  3. This is a multi-line string.  
  4. This is the seconde line.  

Assign values directly when using the variable. You do not need to specify the data type. By default, a logical row is associated with a physical row image. If you want to put multiple logical rows in a physical row, you can add a semicolon after each statement. However, it is strongly recommended that only one logical row be written for each physical row. A logical row can be connected by '\' across multiple physical rows.

 
 
  1. >>> s='This is a string.\  
  2. This is continues the string.'  
  3. >>> print(s)  
  4. This is a string.This is continues the string.  

The above content is an introduction to the practical application solutions of Python objects.

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.