2
텍스트 파일을 출력하는 프로그램을 작성하려고합니다. 내가 그것을 실행하는 동안 그것은 이름을 바꿀 것이다.Python : IOError : [Errno 2] 해당 파일이나 디렉토리가 없습니다 (Raspberry PI)
그러나 나는 그것을 실행할 수 없다. 오류 메시지 여기 [IOError: Errno 2 No such file or directory]
내 코드는 다음과 같습니다
from Adafruit_BMP085 import BMP085
from time import sleep
import time
import datetime
import pickle, sys, os
while True:
class data():
def __init__(self):
self.tp = tps()
self.savedata()
def savedata(self):
now = datetime.datetime.now()
timestamp = now.strftime("%Y/%m/%d %H:%M:%S")
filename= 'Temperature_'+ timestamp +'.txt'
f=open (filename,'a')
timestamp = now.strftime("%Y/%m/%d %H:%M:%S")
self.tp.updateTempAndPressure()
outvalue = self.tp.temp
outvalue_1= self.tp.altitude
outvalue_2= self.tp.pressure/100
outstring = str(timestamp)+" Temperature:"+str(outvalue)+ " C Altitude: "+str(outvalue_1)+ "m Pressure: " +str(outvalue_2)+ "hPa" + "\n"
print outstring
f.write(outstring)
f.close()
data()
time.sleep(1)
거기에 내가 나 전체 작업을 실행할 수 없습니다 원인이 내 코드를 잘못 다른 있나요 놓치지 어떤 기능이? 문 다음 사전
작품! 제안 해 주셔서 감사합니다. – XFrost