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

巴扎黑
Release: 2016-12-03 10:12:55
Original
1803 people have browsed it


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


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


source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template