When you want a function to receive a tuple or dictionary -like parameter, there is a special way to use the * and * * prefixes, respectively . This method is particularly useful when a function needs to obtain a variable number of arguments .[note][
I. How the COMPUTER program worksPrograms written in machine language can be run directly on a computer, and programs written in Assembly and advanced languages (often referred to as source programs) need to be "translated" into machine language to
One, Thread & processFor the operating system, a task is a process, such as open a browser is to start a browser process, open a notepad started a Notepad process, open two Notepad started the two Notepad process, open a word started a word process.
Time and Datatime modulesTime-related operations, time is represented in three ways:
Timestamp after January 1, 1970 seconds, i.e.: Time.time ()
Formatted string 2014-11-11 11:11, i.e.: Time.strftime ('%y-%m-%d ')
Structured time
1./proc/pid/statusYou can view process-related details, which can be viewed when memory is abnormalReference: http://blog.csdn.net/beckdon/article/details/484919092. Top-p Process NumberView process-related memory in real time3. Memory
Reprint Address: http://blog.csdn.net/zv3e189os5c0tsknrbcl/article/details/78661641Is someone talking about whether Python code compiles or interprets execution? The question can be another way of saying: is Python a compiled or interpreted language?
Python's connectors are mainly the plus (+), comma (,), space (), backslash (\), join (),Plus (+), the demo is as follows:#注意, + can only concatenate strings, if one is a string one is a number will be error print "Here is the string" + "Here is
form participates in the actual parameterFormal parameters: In the function definition phase, the parameter defined in parentheses is called a formal parameter, which is equivalent to the variable nameArguments: In the function call phase,
7. Object-oriented advanced programming 7.1 using __SLOTS__Python dynamic language, new object after binding properties and methodsTip: A method bound to an instance that is not valid for another object. The method can be called by all objects after
Function:1, the function can be compared to a tool, the function is a "variable", "variable" must first define after reference. An undefined and direct reference to a function is equivalent to referencing a non-existent variable name, that is, the
Import python module not on Pathhttp://stackoverflow.com/questions/10161568/import-python-module-not-on-pathGeneral Practice:[Python]View PlainCopy
Import Sys
Sys.path.append (' C:/full/path ')
from foo import Util,bar
And to
Existing two files, one file name is ideal.py, the other is hub.py, both are in the directory Modualsio.The specific contents of ideal are:num = 3Class Foo (object):Global numdef foo (self):Return num*3PS: In this usage, if we do not use global to
#coding =utf-8From PIL import Image# parametersFilePath = ' ~/a_1.jpeg 'mode = ' R ' # Here the mode must be r, otherwise errorReading pictures# Image.open () for lazy execution, only to verify if it is a picture, to fetch data only to read dataim =
8 errors, debugging and testing 8.1 error handlingAll exceptions are from baseexceptionError logged:# err_logging.pyImport loggingdef foo (s):return 10/int (s)def bar (s):return foo (s) * 2def main ():TryBar (' 0 ')Except Exception as
Python Hidden variables__doc__ # Indicates comments in this document__FILE__ # Indicates the path to this file __PACKAGE__ # The folder path where the imported py file is located__CACHED__ # Cache of import files__name__ #如果是主文件 __name__ =
Python learning path: day4; python path: day4
Some common built-in functions:
Built-in function 1:
# Callable () # Check whether the function can be called. True and Falsedef f1 () are returned: pass # f1 () # f2 = 123 # f2 () can be called () #
Detailed usage of strip (), lstrip (), and rstrip () in Python, and lstriprstrip
Python has three functions to remove leading and trailing characters and spaces. They are:Strip: used to remove leading and trailing characters and blank spaces
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