在每一個(gè)print后的括號(hào)里加上 file = f,例如:
f = open("output.txt", "w")
print(img,file = f)
f.close()
這里可以不用手動(dòng)創(chuàng)建output.txt,因?yàn)槌绦驎?huì)自動(dòng)創(chuàng)建
在每一個(gè)print后的括號(hào)里加上 file = f,例如:
f = open("output.txt", "w")
print(img,file = f)
f.close()
這里可以不用手動(dòng)創(chuàng)建output.txt,因?yàn)槌绦驎?huì)自動(dòng)創(chuàng)建