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-11-26 09:38:081568browse

python code:

Java code

import os

file = open ("cc.txt")

.system(line)

ruby code:

Java code

file = File.open("ttt.txt")

file.each_line do |line|

%x(scp #{line.cho mp} #{ 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
Previous article:none and null in pythonNext article:none and null in python