保存Python Print内容
resultsmartin = open("PN.txt","w")
print ("\nPositive sentiment : ", (pos * 100.0 /len(comments)),file = resultsmartin)
print ("\nNegative sentiment : ", (neg * 100.0 /len(comments)),file = resultsmartin)
resultsmartin.close()
f = open("output.txt", "w")
print(img,file = f)
f.close()
参考链接:https://www.jianshu.com/p/9ddc4381acb2