Home >Backend Development >Python Tutorial >python opens the file, reads the file command line by line and executes it

python opens the file, reads the file command line by line and executes it

巴扎黑
巴扎黑Original
2016-12-03 10:12:551804browse


import os    
file = open("cc.txt")   
for line in file:  
  os.system(line)


file = File.open("ttt.txt")   
   file.each_line do |line|  
     %x(scp #{line.chomp} #{line.replace("/","")})  
   end


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn