Getting started with Python
1. For the scope of a variable, the execution statement exists in the memory, and the variable can be used (I .e., the scope) if 2 = 2 in the following code: name = 'Alex 'print name is the following conclusion correct? The outer variable can use the memory variable by the inner variable and cannot be used by the outer variable to execute the above Code :#! /Usr/bin/env python #-*-coding: utf8-*-if 2 = 2: name = 'Alex 'print nameprint name [root @ Python day001] # python new_test.pyalexalex [root @ Python day001] # conclusion: For Python, as long as the variables are declared in the memory, then you can directly use the binary and ternary operations result = value 1 if condition else value 2 if condition true: result = value 1 if condition false: result = value 2 example ① name = 'Alex 'if 1 = 1: name = 'SB' else: name = '2b 'code rewrite: name = 'SB 'if 1 = 1 else 2b then you can take out the name directly for corresponding processing. 3. binary representation of various hexadecimal methods, 01 octal, 01234567 decimal, 0123456789 hexadecimal, 0123456789 abcde iv. Python basics ① for Python, everything is an object, and objects are created based on classes (or objects are created by classes) ② In Python, any object has its own class, and any object attribute is referenced by its own class method.