Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40114
| Date | 2013-02-28 01:38 -0500 |
|---|---|
| From | Dave Angel <davea@davea.name> |
| Subject | Re: How to edit offline vmx file using python |
| References | <fc5064fb-3119-4aa6-ae2f-e7c23dd13196@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2640.1362033540.2939.python-list@python.org> (permalink) |
On 02/28/2013 12:29 AM, sasikiran2k7@gmail.com wrote: > Hi, > > I am new to python, how can we edit a .vmx file offline or just simply a file containing the data in the below format. > > My file sample.vmx contains data > > pciBridge7.virtualDev = "pcieRootPort" > pciBridge7.functions = "8" > vmci0.present = "TRUE" > hpet0.present = "TRUE" > nvram = "testvmdk.nvram" > virtualHW.productCompatibility = "hosted" > powerType.powerOff = "soft" > powerType.powerOn = "hard" > > > I need to update those values and the updated file should contains the data > > pciBridge7.virtualDev = "pcieRootPort" > pciBridge7.functions = "8" > vmci0.present = "TRUE" > hpet0.present = "TRUE" > nvram = "testing.nvram" > virtualHW.productCompatibility = "hosted" > powerType.poweroff='hard" > powerType.poweron="sof't" > > Since the file is tiny, start by reading it all into memory, into a list. Then replace last two line's 16th character with a lowercase "O" And replace the last line's string following the equals sign with the string "\"sof't\" There are also some spacing differences, but they're harder to describe, and I suspect they were accidental. -- DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
How to edit offline vmx file using python sasikiran2k7@gmail.com - 2013-02-27 21:29 -0800 Re: How to edit offline vmx file using python Dave Angel <davea@davea.name> - 2013-02-28 01:38 -0500
csiph-web