import os
cmd = r'type c:\foo.txt'
os.system(cmd)

 

 

import os
cmd = r'type c:\foo.txt'
os.system(cmd)

 

注意要有r  否则 \ 就是 另外的含义