Mutable and immutable Type objectsMutable and immutable, essentially changing the memory address After the data is changed
Variable type, non-hash
Immutable type, can hash
List
String
Dictionary
Digital
Collection
Meta-group
Immutable collections
What is a mutable/immutable objectAn immutable object in which the object points to an in-m
Assigning values to variablesVariables in Python do not need to be declared, and the assignment of variables is the process of declaring and defining variables.Each variable is created in memory and includes information about the identity, name, and data of the variable.Each variable must be assigned before it is used, and the
1. Single Underline:
A single underline named variables (including classes, functions, generic variables) cannot be imported into another module through the From module import *.
testa.py
# testa.py
_foo (object):
Fun (self):
print (' Fun in Class _foo ')
_bar (a):
Print (a)
testb.py
*
a = _foo ()
_bar (' Hello World ')
C = _foobarTestb.py will complain:
Traceback (most recent call last):
defined
2. Double underline:
There are no private keyw
Variable naming and usage # variable names can only contain letters, numbers, and underscores. [cannot start with a number] [0020.sendmessagex] [send_message_001] leading # the variable name cannot contain spaces, you can use underscores to separate the word [sendmessagex] [send_message] into # you cannot use the Python
The usage and notes of variable parameters of custom functions in Python are discussed in detail.
Variable parameters
Python has two types of variable parameters: List and dictionary. The list type is similar to the variable param
Copy Code code as follows:
A = 3
b = A
The first picture (Figure 1), you can see it at a glance:
Variable names and objects, after running assignment statement B = A, the variable a,b points to the memory space of object 3.Assuming that you execute a = ' python ', a will point to the string object you just created.Let's try this again:
PrefaceSETX is not a tool that comes with windows, it needs to be downloaded from Microsoft's website, but some systems will bring it. (provided by the official, can be assured to eat)Both set and SETX can be used to configure environment variables. Their difference is that set is just a temporary modification of environment variables, the effect disappears after the console shuts down, and setx can permanently change the environment variable (the reg
Assign values to a variable: for example, A=1. When assigning a value to a variable, the variable is created to store the value in memory, which means that the variable is created in the memory space (corresponding to one address: one value)Python is a dynamic type of langua
Variable reference Order Python refers to the order of variables : The current scope local variable, the outer scope variable, and the global variable->python built-in variables in the current module.1. GlobalThe global keyword i
Python day1 variable, pythonday1Python path, Day1-Python basic 1 variable
Variables are used to store reference and operation information in computer programs. They also provide a way to mark data with descriptive names so that our programs are more clearly understood by readers and ourselves. It is helpful to think of
One, the JAVA environment variable configuration:New System Variables Java_home and ClasspathVariable name:java_homeVariable value:C:\Program files\java\jdk1.7.0Variable name:CLASSPATHVariable value:.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar;Where the variable value is for you to install your own JDK file directory here to be aware.Select the environment variab
In Python, equals = is an assignment statement that can assign any data type to a variable, the same variable can be repeatedly assigned, and can be a variable of different types, for example:
A = 123 # A is an integer
Print a
A = ' Imooc ' # A becomes a string
Print a
This type of
In Python, a variable is not just a Boolean value of a variable, but a true one that satisfies any of the following conditions: The variable exists, is not NULL, is not a Boolean false. Conversely, when the value of a variable is false
In
1. What is a variableVariable as the name implies the amount of change, the amount is a way of representing a state, and can be changed2, why to use the variableThe execution of a program is always in a state of flux, and we can use a variable to represent the state of the program in progress and record it.3. How to use variablesKey=valueExampleA=123Three elements of a variable:Key ———— "a"= ————— "Assigned value123 ———— "Specific status (content)A
Python file read/write operations interact with linux shell variable commands,
It is quite convenient for python to read and write files. The interaction variables with linux shell need to be converted before they can be used. This is a headache!
1 # coding = UTF-8 2 #! /Usr/bin/python 3 import OS 4 import time 5
This example describes how Python file read and write operations interact with the Linux Shell variable command. Share to everyone for your reference. Specific as follows:
Python is easy to read and write to files, and the interaction variables with the Linux shell need to be converted to be used, which is more of a headache.
The code is as follows:
The cod
Analysis of parameter definitions and Variable Parameter usage of functions in Python
This document describes the parameter definitions and Variable Parameter usage of functions in Python. Share it with you for your reference. The details are as follows:
When I first learned how to use
Variable sharing between threads in Python multi-process Programming
This article mainly introduces how to share variables between threads in Python multi-process programming. multi-process programming is an important advanced knowledge in Python learning. For more information, see
1. Problem:
Some people in the group
Variable hardest HitI. Variables and naming conventions 1.1 What is a variable?As the name implies, the changing amount is variable. Give a chestnut: a = 0. A is a variable, reason: After a assignment of 0, you can re-assign a = 1 a=2 a=3.etc1.2 Inverse scales of variables:What are the non-palpable scars of a
Zman's study notes Python article: 1. Decorative Device 2. Function "Variable length parameter"This time to talk about the "variable length parameters" of functions in Python, which is often used in practice.First, what is "variable length parameter"A
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.