Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40109 > unrolled thread
| Started by | sasikiran2k7@gmail.com |
|---|---|
| First post | 2013-02-27 21:29 -0800 |
| Last post | 2013-02-28 01:38 -0500 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
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
| From | sasikiran2k7@gmail.com |
|---|---|
| Date | 2013-02-27 21:29 -0800 |
| Subject | How to edit offline vmx file using python |
| Message-ID | <fc5064fb-3119-4aa6-ae2f-e7c23dd13196@googlegroups.com> |
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" Can anyone please help me in solving this problem Thanks, Sasikiran
[toc] | [next] | [standalone]
| From | Dave Angel <davea@davea.name> |
|---|---|
| Date | 2013-02-28 01:38 -0500 |
| Message-ID | <mailman.2640.1362033540.2939.python-list@python.org> |
| In reply to | #40109 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web