1, new Pythonmodule load path
Ruiy tip (about python list[] Database type special you know!append (""), Extend ([""]))
2,print (SYS.ARGC) list[""] The data information displayed in a list form;
The first element of the SYS.ARGV list is always the name of the program, and the other elements are the elements of the SYS.ARGV list, starting from 1; see here, crossing you should understand, and shell environment variable $0-$n?
3,python, you will find that the more you are with List[],tuple (), dict{} Hollingsworth.
columns, such as the Python built-in modules listed above, organize data in different data types, and when you see the types of organization data, you should know how to manipulate them using their respective data type operations.
eg:dict{} values (), keys (), list[] Append (""), Extend ([""])
4. Print the running Scope name
Print (__name__);
__MAIN__ is a special reserved word, which is the name of the top-level global scope
if __name__ = = ' __main__ '; for the modules module you create, it will load properly!
5,python functions and types used to read and write files and access directories
Larger programs will use files to read input and storage output;
Python file object, the action path, gets the file information, accesses the contents of the directory;
Look at the illustration
From the above path built-in module can be seen in the Python backslash is very wonderful! You should know, don't explain!
Also place the letter R before the opening quotation marks, and remove the special handling of the backslash in the string, such as win below the path C:\win\Ruiy
is represented as R "C:\win\Ruiy" in Python
or C:\\win\\ruiy
6,python Operating files
Create a file operation function with parameters, specify the file name, the contents of the files, but the current function overwrites the original contents of the file!
7,append, append content to text
See, if you really write executable shell program, we can adjust the line in the above program \ n or others mothed, you should understand, Ruiy think!
8,python reads the contents of the file, reads or reads all the contents of the file in Reasdline line, respectively.
9,f = open ("ruiy.sh", "R") the handle of the action file
Print text, Python takes a newline character as a true newline character, not \ n, and deletes the close file object after the read is completed
After we have finished manipulating the files, we need to release the related object resources, using Del
See below you should understand the difference between the Readline,readlines
Del python file manipulation handle
10,python dir directory and path operation, Python hides the cumbersome directory and path operations in the OS module;
from OS import *;
Os.path
Combine directory names into paths
Detach the last directory of a path
See what you know about this?
Os.path.splitext (extended name in exploded file name)
Os.path.normsplit ()
Python module catalog file follow-up