Python写txt

import sys
imageJPath = r'D:/Softwares/fiji-win64/Fiji.app'
sys.path.append(imageJPath)


import os
# print(os.system('ping www.baidu.com'))

if os.path.exists()


curImg = r'D:/Data/Aloe512.png' # image path
macro2 ='open("' + curImg + '");' + 'run("ROI Manager...");' #macro 内容
ijmPath = r'D:/PythonProject/NakedSomaToolPython/resources/results2.ijm'

with open(ijmPath, "w") as f:
    f.write(macro2)

# cmd = 'ImageJ-win64 ' + '-macro ' + r'D:/PythonProject/NakedSomaToolPython/resources/results.ijm'

cmd = 'ImageJ-win64 ' + '-macro ' + ijmPath
print(os.system(cmd))

 

with open(".\log.txt", "a") as f:   f.write(macro2)

是追加的模式


 

 

with open(ijmPath, "w") as f:

f.write(macro2)

posted @ 2020-08-02 17:06  bH1pJ  阅读(33)  评论(0)    收藏  举报