First, remove the current path:
Base_dir1 = Os.path.dirname (Os.path.dirname (__file__))
Base_dir2 = Os.path.dirname (Os.path.abspath (__file__))
# __file__: Refers to the directory address where this file resides (including the file name) but is
1. If I want to mock the date object in the library, but I just want to mock the Today () method, that is, today () returns the results I want, but other date initialization methods cannot be changed.
From datatime import date with
patch ('
The code runs in Ipython-notebook and imports the Cython environment in Ipython-notebook.
1
%load_ext Cython
Cython can be doped with static types of C and C + + in Python, the Cython compiler can compile Cython source
Profile :
Pycharm provides profiling Tools run-profile, as shown in the following figure. The profile tool can be used to analyze the code performance and find the bottleneck.
Test:
Here is a section of the test code to illustrate how to use the
In Python, you define a function to use a DEF statement, which in turn writes out the function name, parentheses, arguments in parentheses, and a colon:, and then, in the indent block, the function body is written, and the return value of the
Python can coexist with multiple versions of the Mac, and there are several Python directories, but in general, it's easy to get a Mac with Python.
Mac system with Python, perhaps the Python version needs to be updated, so the directory structure to
We often encounter this situation in the operation of data, the need for some environment-generated log data analysis, and some large company friends, often do not have the authority of the server, so we need to automatically import data into MySQL,
1. Ready to do a login 126 mailbox operation, with Firefox firebug view the user name box ID, password box ID is id= "auto-id-1491067388576"
Such a class, F5 refresh the browser, looked back at the User name box, password box ID is changed, so you
When using Python, you will always encounter the use of path switching, such as the test.py under folder test to invoke the Data.txt file under the Data folder:
.
└──folder
├──data
│ └──data.txt
└──test
└──test.py
A method
Web crawler technology is very popular on the internet, and using Python to write web crawler is very convenient. The author last year because of personal need to write a copy of the animation for the crawl P station of the crawler, now want to use
There are several points to understand to resolve this problem:Unicode encoding is used by default in Python3, which means that support for Chinese will be better, input Chinese, and display Chinese directly. But when assigning "\xe4\xb8\xad"
This function is to implement access to the parent class or sibling object, and is to return a proxy class object to access the parent class or sibling class method. This function is used primarily to avoid using the class name of the base class
1 Single underline before name (_variablename)
An instance variable name that starts with an underscore, for example _name, such an instance variable outside is accessible, but, according to the conventions, when you see such a variable, meaning,
Ubuntu 16.04 itself is a python, and he's a 2-self. X and 3.X, two versions, the default is 2. X. Here's a note of how to switch between versions and how to switch the Python version to 3. The method under X.
1. View the installed Python version of
1. Process Overview
Python compiles the code (. py file) into bytecode, handing it to the bytecode virtual machine, and then the virtual machine executes a byte-code instruction, which completes the execution of the program. 2. Byte code
The byte
Crawling with embarrassing contentGitHub Code Address https://github.com/injetlee/Python/blob/master/qiubai_crawer.pyPublic number: "Smart manufacturing column", welcome attention.Objective of this article
Mastering the basic concepts of
Pyqtgraph official Give an example of an error 2333Official Document Portal: # # # # #pyqtgraph ExportPyqtgraph support right-clicking in the Visual window (exporting from the GUI) tried it only to save in SVG format,Save as PNG will flash back
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service