Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Python data types summary     - Use backup-manager system backup on Linux (Linux)

- Linux kernel programming parameter passing between modules and function calls (Programming)

- Linux system package manager -RPM (Linux)

- Linux Troubleshooting: How to save the status of the SSH session is closed (Linux)

- How to remove the Linux memory Cache, Buffer and swap space (Linux)

- Scala REPL Shell call (Programming)

- OpenSSL to generate public and private key (Linux)

- Install Git on CentOS (Linux)

- socket busy poll of Linux kernel 3.11 to avoid sleep switch (Linux)

- Ubuntu Eclipse configuration Gtk + 2.0 libraries (Linux)

- Linux in order to make NMAP hide and seek with the firewall (Linux)

- How to install the Linux text editor Atom 0.124.0 (Linux)

- Configuring Allatori code confusion when developing general Java applications in NetBeans (Programming)

- MongoDB Learning the notes (Database)

- Linux OOM killer mechanism (Linux)

- How to set the default Fedora from the command line (Linux)

- Ubuntu installation 2.10.x version of Scala (Linux)

- DBCA Error: ORA-19809: limit exceeded for recovery files process (Database)

- Linux performance optimization features Tuned and ktune (Linux)

- To share Linux script automatically change passwords (Linux)

 
         
  Python data types summary
     
  Add Date : 2018-11-21      
         
         
         
  In situ type variable and immutable types

Situ immutable type can be called a hash (hashable) type, also known as in situ variable type is not available hash type.

Situ immutable type:

Numeric types: int, float, decimal.Decimal, fractions.Fraction, complex
String type: str, bytes
tuple
frozenset
Boolean type: True, False
None
Situ variable type:

list
dict
set

How to actually test whether a variable place

hash or will return to their home can not change the type of hash value, if a second call to place variable type function, then returns TypeError.
Only hash types can only be used as dict key.
Only the type of hash can only be placed in the set, so the set itself is not stored in a set of nested.
for example:

>>> Hash (b'aaa ')
6904179387427091653
>>> Hash (bytearray (b'aaa '))
Traceback (most recent call last):
  File "< stdin>", line 1, in < module>
TypeError: unhashable type: 'bytearray'
>>> Hash (frozenset ({1,2,3}))
-7,699,079,583,225,461,316
>>> Hash ({1,2,3})
Traceback (most recent call last):
  File "< stdin>", line 1, in < module>
TypeError: unhashable type: 'set'
How to verify whether the operation is a practical place changed.

Built-in function id () returns the address of an object actually stored in memory.

>>> L = [1]
>>> Id (L)
49689480
>>> L.append (2)
>>> Id (L)
49689480 # in-place editing, so you can see the store address has not changed.
>>> S = 'aa'
>>> Id (s)
47072456
>>> S + = 'bb'
>>> Id (s)
# 49700008 not in place due to the changes, so when the string changes, opened up a new store a memory address.
>>>
Data stored in an orderly manner

Ordered data type

Ordered data type called sequence, support indexing, slicing, addition, multiplication, calculate the length, compare the size of the operation.
Comparison will compare the size of each element in turn, if not followed when comparing the same type found will pop up an error.

list
tuple
str
bytes

Unordered data type

dict
set
     
         
         
         
  More:      
 
- Hadoop 2.6.0 standalone configuration and pseudo-distributed configuration under Ubuntu 14.04 (Server)
- IOS interview questions Summary (Programming)
- Linux nice program origin of the name (Linux)
- Ora-14450: attempt to access ah transactional temptable already in use (Database)
- Install minimize RHEL / CentOS 7 some things need to do (Linux)
- Database start listening TNS-12537, TNS-12560 error (Database)
- The method to mount the CD under Linux (Linux)
- Linux / CentOS 7.0 installation and configuration under Tomcat 8.0 (Server)
- Ubuntu 14.04 build Gitlab (Linux)
- Ubuntu Server (Ubuntu 14.04 LTS 64-bit) installation libgdiplus 2.10.9 error solution (Linux)
- Rman Oracle database backup and recovery plan (Database)
- Linux / Windows setup is complete port range (Linux)
- The specified user to execute commands under Linux (Linux)
- C # and JavaScript arrays to re-summary (Programming)
- ASP.NET 5 (vNext) Linux deployment (Server)
- iOS custom keyboard emoji expression (Programming)
- Use the TC flow control test under Linux (Linux)
- Daemon under Linux (Linux)
- Tmux create the perfect terminal management tool under CentOS (Linux)
- Setting Wetty do not need an account login command line operations (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.