If you use input and raw_input to read a file directly on the command line, and you want to take the file directly into the command line to handle it,
The input method can be handled directly, and if you want to use the Raw_input method, the address of the read file will be enclosed in quotation marks, and you will need to manually remove the quotes to process the file.
Test the code in Ipython: (read the address string of a picture file)
A = input ("Input a:\n")
print "The Input method:", a
B = raw_input ("Input b:\n")
print "The Raw_input method: ", b
input A:
'/home/sunny/caffe-master/examples/images/cat.jpg ' the
Input method:/home/sunny/ Caffe-master/examples/images/cat.jpg
input B:
'/home/sunny/caffe-master/examples/images/cat.jpg '
The Raw_input method: '/home/sunny/caffe-master/examples/images/cat.jpg '
In addition, for the two input methods another intuitive difference is the input of the processing function, that is, the input formula will directly output the results, and Raw_input will be authentic (raw) output:
#! -*-coding:utf-8-*-
print raw_input (U ' Test raw_input:\n ')
print input (U ' Test input:\n ')
Test results: