我正在制作一个 python 脚本来卷曲幻想曲棍球记分牌页面,调用 perl 以正则表达式替换球队名称和分数,并显示它。正则表达式已全部设置,但现在我无法获取网页。我注意到当我在我的电脑上运行后
curl -o /tmp/fantasyhockey.txt http://games.espn.go.com/fhl/scor...
命令,按一次回车将启动它,然后再按一次将退出并制作我的页面。如何强制 python 按回车键?出于我的好奇,为什么要等待?
编辑:这是脚本。没什么。
import os
def main():
os.system("curl -o /tmp/fantasyhockey.txt http://games.espn.go.com/fhl/scoreboar\
d?leagueId=xxxxx&seasonId=2013")
unfix = open("/tmp/fantasyhockey.txt", "r").read().replace('\n', '')
outfile = open("/tmp/fantasyhockey2.txt", "w")
outfile.write(unfix)
outfile.close()
os.system("perl regex.pl < /tmp/fantasyhockey2.txt")
os.system("rm /tmp/fantasyhockey*")
main()