This time to bring you how to use NumPy to find the maximum and minimum values in the array, with NumPy to find out the maximum and minimum values in the array of considerations, the following is the actual case, together to see.
Create an array using NumPy in Python, and then we want to get the maximum value of the array, the minimum value. You can use this method:
First, create an array
This allows you to get the maximum and minimum values for an array.
And you can use Np.where (Np.max (a)) to get the maximum, minimum number of rows and columns.
Second, the operation of the file under Python
1. Move a folder to another folder
First of all
Import OS, Skutil
To copy a file:
Shutil.copyfile (' Oldfile ', ' newfile ')
Oldfile and NewFile can only be files.
Shutil.copy (' Oldfile ', ' newfile ')
Oldfile can only be a folder, NewFile may be a file, or it can be a destination directory
To copy a folder:
Shutil.copytree (' Olddir ', ' newdir ')
Olddir and Newdir can only be directories, and newdir must not exist
To move a file:
Shutil.move (' Oldpos ', ' Newpos ')
To rename a file:
Os.rename (' oldname ', ' newname ') files and directories use this command
To delete a file:
Os.remove (' file ') os.rmdir (' dir ')
Only empty directories can be deleted
Judgment target:
Os.path.exists (' goal ')
Determine if the target exists
Os.path.isdir (' goal ')
Determine if the target is a directory
Os.path.isfile (' goal ')
Determine if the target is a file
To convert a directory:
Os.chdir (' path ')
Determine if the path exists:
isexists = os.path.exists (path)
Exists True
does not exist False
To create a directory:
Os.mkdir (' file ')
To create a multi-level catalog:
def mkdirs (path): # Remove First space path = Path.strip () # remove tail \ Symbol Path = Path.rstrip (' \ \ ')
Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!
Recommended reading:
How Python strings are converted to two-dimensional arrays
The object of diff is the virtual Dom