Posts
Common Commands in Django Development
· β˜• 1 min read
Creating a Django Project 1 django-admin startproject your_project_name Creating an App 1 2 3 django-admin.py startapp your_app_name # ζˆ–θ€… python manage.py startapp your_app_name python manage.py and django-admin do essentially the same thing. The difference is that python manage.py also sets the DJANGO_SETTINGS_MODULE environment variable and adds the project’s path

Python2 Source Code Study: Dictionary and List Implementation
· β˜• 5 min read
1. Why Dictionary Lookups Are Faster Than List Lookups First, take a look at the following piece of code. 1 2 3 4 5 6 7 8 9 10 11 12 13 from time import time t = time() data = [chr(i) for i in range(97, 123)] # data =

Python2 VS Python3
· β˜• 1 min read
1. Differences Between Python 2 and 3 Feature \ Version Python 2 Python 3 print as a function print"abc" print(“abc”) Unified class Old-style and new-style classes New-style classes only Floating-point division 1/2=0 1/2=0.5 String formatting %, Format Format,% xrange replaces range xrange range long renamed to int Long,int Int Package imports Relative imports Absolute imports Source file encoding Ascii utf8 The official Python recommendation is strongly in favor of learning Python 3 directly, since Python 2 is only maintained through 2020.

Python 2 Source Code Study: Windows Compilation
· β˜• 2 min read
1. Compiler Preparation Prepare the Python source code From the official Python website, download the source code for the Python version you need to compile. The one chosen here is the latest Python 2 release, Python-2.7.14.tar.xz, click here to go there. Prepare a compiler On Windows, the project files built

Python2 Source Code Study: pyc
· β˜• 8 min read
This article uses the Python 2.7.8 source code as an example. 1. Common File Formats in Python py file A Python source code file, which can be modified with a text editor. pyc file The bytecode file generated after Python source code is compiled. pyw file When a pyc file is executed, a console window appears; when a pyw file is executed, it does not.