| Python class import and assertion |
Create a new Python package and create a new class inside it. 2. Create a new Python file under the statistics directory of the package, and import the contents of the Python package. and asserts whether this result is a string. The following are the specific examples:
1 class Dog (object): 2 def __init__ (self): 3 Self.name ="haha"
1 Importimportlib2AA = Importlib.import_module ("Lib.aa")3 Print(Aa.dog (). Name)4 5 assertType (Aa.dog (). Name) isStr#assert that he is a string in order to perform the subsequent content6 7 Print("AA")
| In reviewing the problem of Python3 coding |
The default encoding in Python3 is bytecode, which is bytes. A binary format must be in the data transfer, so it must be cast to the Uncode format.
UTF-8 encoding: Is the compression and optimization of Unicode encoding, he no longer uses a minimum of 2 bytes, but all the characters and symbols are categorized: the contents of the ASCII code is saved with 1 bytes, the characters in Europe are saved in 2 bytes, and the characters in East Asia are saved in 3 bytes.
Here's how to convert
Python Road Eighth _socket_2