How do I think of the flag in Docker first, because Docker uses the C/s structure, and daemon and client are all using the same program, so in order to make a distinction, it must be distinguished by parameters. First look at the main function code under./docker/docker/docker.go: The func main () {////must return FALSE for the first time because there is no initializerif reexec. Init () {return}//Set terminal emulation based on platform as Required.stdin, stdout, stderr: = term. Stdstreams () Lo
program ", for example:Import stringf= ' abcdefghijklmnopqrstuvwxyz ' # Define a stringS1=f.upper () # convert to uppercase, do not change fPrint (S1)Print (F.find (' F ')) # return F the index value (that is, in the string from 0 number of start)s2=f.replace (' B ', ' Boy ') # return b by Boy Replace the string, do not change fPrint (s2)>>>Abcdefghijklmnopqrstuvwxyz5Aboycdefghijklmnopqrstuvwxyzother strin
interface{} = 1var v2 interface{} = "abc"var v3 interface{} = struct{X int}{1}
If the function intends to receive any data type, the reference can be declared as interface{}. The most typical example is the print and Fprint series functions in the standard library FMT package:
Copy Code code as follows:
Func fprint (w io). Writer, a ... interface{}) (n int, err error)Func
, timeout 0Requests/sec: 4408.87Transfer/sec: 546.80KBRecently studied Golang, and conducted basic tests on HTTP services based on the official guidelines:Package MainImport ( "FMT" "Log" "net/http") Type Hello struct{}func (H Hello) servehttp (w http. Responsewriter, R*http. Request) {fmt. Fprint (W,"Hello world!")}func Main () {h:=hello{} ERR:= http. Listenandserve ("localhost:8080", h)ifErr! =Nil {log. Fatal (Err)}}The result was an e
How do I read and write files in python?Four parts:Open FileRead fileWrite fileClose FileExample:How to open children files and showData=open ('children') #指向要打开的文件f=data.read () #读取文件内容 and assigned to Fprint (f) # Print file Data.close () #关闭文件, equivalent to returning memoryFile open default is read-only permission, but we can open the file with additional permissions, such as Read and writeData=open ('children','r+', encoding='utf-8 ') F=data.rea
Decorators are used to wrap functions, add extra functionality, and should be able to decorate a batch of functions to reduce code reuse.a simple decoratorA function receives a function object as a parameter and returns a function object, such that a function can become a decorator, as defined below:def deco (func): Def _deco (*args): print "Do Something" func (*args) return _decoIn the above decorator, Func is called the modified function, and some additional initialization is done before the F
Find commandThe Find command is used to locate files under the specified directory. Any string that precedes the parameter will be treated as the name of the directory you want to find. If you use this command without setting any parameters, the Find command looks for subdirectories and files under the current directory. and displays all the subdirectories and files that are found.GrammarFind (options) (parameters)Options-amin-anewer-atime-cmin-cnewer-ctime-daystart: Calculate the time from toda
name of the directory you want to find. If you use this command without setting any parameters, the Find command looks for subdirectories and files under the current directory. and displays all the subdirectories and files that are found. Find (Options)-amin-anewer-atime;-cmin-ctime -daystart: Calculate the time from today;-depth: Start searching from the deepest subdirectory under the specified directory;-expty: Look for files with a file size of 0 byte, or empty directories without any subdir
under the specified directory;
-expty: Look for files with a file size of 0 byte, or empty directories without any subdirectories or files in the directory;
-exec
-false: Sets the callback value of the Find command to false;
-fls
-follow: Exclude symbolic connections;
-fprint
-fprint0
-fprintf
-fstype
-gid
-group
-help or--help: online help;
-ilname
-iname
-inum
-ipath
-iregex
-links
-iname ;
-ls: Assuming that
)Output Result:>>>A is:10B is: {' Y ': 2, ' X ': 1, ' Z ': 3}Example of a tuple parameter (*args):def testtuple (a,*b):print ' A is: ', aPrint BCall function Method One:tup= (' A ', +, ' B ')Testtuple (1,*tup)Call function Method Two:Testtuple (1, ' A ', and, ' B ')Output Result:>>>A is:1(' A ', 1, 2, ' B ')
5. Anonymous functions
Python can use the keyword lambda to define an anonymous function, and when an object of a function type is needed, an anonymous function can be created to
argument to '-exec '", where the first command error is due to the fact that ";" is missing, while the second command error is due to the execution of a statement in the Shell ";" is considered to be a terminator, not a-exec parameter, so it must be escaped when used. [[emailprotected" standard]# find-name ' *.c '-exec Grep-hna ' Is_array ' {} find:missing argument to '-exec ' [[emailprotected" standard]# find. -name ' *.c '-exec grep-hna ' Is_array ' {}; find:missing argument to '-exec ' [
======================================================Find-name april* Find files starting with April in the current directoryFind-name april* Fprint file finds files starting with April in the current directory and outputs the resultsFind-name ap*-o-name may* Find files that start with an AP or MayFind/mnt-name tom.txt-ftype vfat to find files with the name Tom.txt and file system type VFAT under/MNTFind/mnt-name T.txt! -ftype VFAT under/mnt to find
"-exec grep "Cnscn" {} \;
See if there are CNSCN users
Find. -name "yao*" | Xargs file
Find. -name "yao*" | Xargs echo "" >/tmp/core.log
Find. -name "yao*" | Xargs chmod o-w
Find-name april*
Find files starting with April in the current directory
Find-name april* fprint File
Finds files starting with April in the current director
Dec 15:36/etc/httpd/conf/httpd.conf
The following table is a list of commonly used to find files and display file information parameters and how to use
Option Usage Description-exec command to find and execute commands-fprint file Print full filename-fprint0 file Print file full file name including empty files-fprintf file format to print files-ok command to perform actions on user commands, confirming input execution according to user's Y-printf fo
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.