首页 > 解决方案 > 在 python 中的命令中添加定义

问题描述

我有 c 是一个定义(下面的代码)。如何将它添加到命令中以在 python 中运行?谢谢你。

text_file = open("lastline.txt", "w")
n = text_file.write(last_line)
text_file.close()

with open('lastline.txt', 'r') as f: 
      c = f.read(12)
print("Detected disk identifier as", c)
os.system("diskutil unmount c")

标签: pythoncommand

解决方案


os.system("diskutil unmount %s", c)

推荐阅读