Python Call Shell
get_line_num= "Wc-l As_uniq_info | awk ' {print '} ' "# # #get the lines of" As_uniq_info "
Line_num = os.popen(get_line_num). read (). strip (' \ n ')
Get_line_num a command that executes as a shell, gets the number of lines of file As_uniq_info file
Os.popen (get_line_num): Execute shell
Get_line_num = Os.popen (get_line_num). Read (): Call read, assign to Get_line_num, at which point the get_line_num contains a newline character ("\ n").
Os.popen (Get_line_num). read (). strip (' \ n '): Remove line break
Shell references Python variables
Line_num = Os.popen (get_line_num)
The get_line_num variable in Python is referenced.
Python references the value in the shell
Line_num = Os.popen (get_line_num). Read ()
After executing the shell, assign a value to the variable in Python via the Read () function line_num
Python invokes shell, shell references python