开发者

Save python plistlib data

开发者 https://www.devze.com 2023-04-04 18:28 出处:网络
how do I save the output I get for this program开发者_如何学Go(as a variable), instead of it being printed?

how do I save the output I get for this program开发者_如何学Go(as a variable), instead of it being printed?

import plistlib, time
import plistlib as pl
p=pl.readPlist("Restore.plist")
print p["ProductType"]#I want this to be outputted as a variable, such as 'x' instead of   python printing it.
print p["ProductVersion"]
print p["ProductBuildVersion"]


something like this?

outputfile = open('output.plist', 'w')
outputfile.write(p["ProductVersion"])
outputfile.close()


It's already a variable. Namely, it's part of the variable p. If you want to assign it to another variable use the = sign like on line 3 of your code.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号