Python函数手册

1.os

(1) Defination:

os.path.exists(a) #judge if the path exists or not

(2) Demo:

a = '\D\Python\project111'

print os.path.exists (a)

(3) Results:

Fasle

(4) Reference:

https://www.cnblogs.com/pingqiang/p/7817983.html

2. def

(1) Defination:

def function_name (paremeters):

expressions #if want to reture paremeters . please using return function

(2) Demo:

def function ():

print('This is a function')

a= 1+2

print(a)

(3) Results:

This is a function

(4) Reference:

https://www.cnblogs.com/derezzed/articles/8119592.html

3. argparse

(1) Definition:

impore argparse

parser =  argparse.ArgumentParser() #build a new object

parser.add_argument() #introduce command line paremeters and  options

parser.parse_args()  #make analysis

details:

name or flags: choose name of string , e.g. foo or -f, --foo

action: command line action when across into one paremeters,

nargs: numbers of command line paremeters

const: needing by action and nargs

help: reference information

(2) Demo:

(3) Result:


(4) Reference:

https://blog.csdn.net/lly_zy/article/details/97130496

4. super

(1) Defination:

def__init__(self,dim_in,dim_out):

super(test, self)._init_()

你可能感兴趣的:(Python函数手册)