0
StringIO로 완료된 memfile을 실행하고 싶습니다. 그것을 할 가능성이 있습니까? 이런 일이 :python 실행중인 StringIO 파일
import StringIO
memfile = StringIO.StringIO()
memfile.write("print 'hello world'")
#with diskfiles I would do:
#os.system('python memfile') ?
#subprocess.Popen('memfile', shell=True)
memfile.close()
를 그리고 무엇을 것 메모리 파일을 실행해야합니까? 파이썬 코드, bash 스크립트, 바이너리 실행 파일? –
'memfile'에 쓰여진 예제 내용은 파이썬 코드처럼 보입니다. – piokuc
exec memfile.getvalue()로 해결했고, memfile 내용 "a = 0 \ nb = 1 \ nprint a + b "감사합니다 – user2455985