简体   繁体   中英

loop the function of html parser

I want to loop for the 1,2,3 which is the file name, I can run with this in script. But, I would like to do for loop at here:

eval('!html_parser.py 1');
eval('!html_parser.py 2');
eval('!html_parser.py 3');

And I get the error for this:

for i = 1:3

eval('!html_parser.py',strcat(int2str(i)));

end

在此处输入图片说明

html_parser.py

from optparse import OptionParser
p = optparse.OptionParser('%prog')
(options, args) = p.parse_args()

folder_count = args[2]

driver = webdriver.Firefox()

pattern = "*.*htm*"

captured_text = ''

If you need to build the different strings as in your first snipped, you might want to consider this

for i = 1:3

   eval([ '!html_parser.py ', num2str(i) ]);

end

Here the string is built by (implicit) concatenation of two strings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM