import numpy as npdata = np.array([[1,2], [3,4]]) np.savetxt('out.txt', data, fmt="%d") #保存为整数np.savetxt('out1.txt', data, fmt="%.2f", delimiter=',') #保存为2位小数的浮点数,用逗号分隔with open('out.txt') as f: for line in f: print(line, end='') 1.pyt
抓取知乎今日最热和本月最热的前三个问题及每个问题的首个回答,保存至html文件,该html文件的文件名应该是20160228_zhihu_today_hot.html,也就是日期+zhihu_today_hot.html 代码如下: from selenium import webdriver from time import sleep import time class ZhiHu(): def __init__(self): self.dr = webdriver.Chrome() sel