Sex*_*ast 1 python perl subprocess wget command-prompt
我通常使用WGET从某个网页下载一两个图像,我从命令提示符处执行以下操作:wget 'webpage-url' -P 'directory to where I wanna save it'.现在我如何在Perl和Python中自动化它?这是什么命令使我能够模拟,好像我在命令提示符下输入命令?在Python中有很多类似的模块,如subprocess,os等,我很困惑.
小智 8
在Perl中,最简单的方法是使用LWP::Simple:
use LWP::Simple qw(getstore);
getstore('www.example.com', '/path/to/saved/file.ext');
Run Code Online (Sandbox Code Playgroud)