Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54168

Re: Appending data to an excel sheet by python code

Date 2013-09-14 18:06 +0100
From MRAB <python@mrabarnett.plus.com>
Subject Re: Appending data to an excel sheet by python code
References <87454429-bd36-44b2-bef1-055d976c16ae@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.377.1379178380.5461.python-list@python.org> (permalink)

Show all headers | View raw


On 14/09/2013 12:33, Manoj Rout wrote:
> hi
>    i want to append some data to an existing excel sheet by reading from  file.But here i am facing 2 problem.first is when i am reading from file.
>
>
> import re
>
It's a good idea to use raw string literals for file paths on
Windows. Alternatively, you could use forward slashes instead of
backslashes.

> file=open("C:\Workspace\WS2\P1\Dave\Generated\src\UART001\UART001_Conf.c","r")

Here you're reading the entire file:

> strings=re.search(r'(?<=(.Mode = UART_))\w+',file.read())

Here you're trying to read the entire file again, but you're already
read to its end, so you'll now get an empty string:

> string=re.search(r'(?<=(.StopBit = UART_))\w+',file.read())
>
> print strings.group()
> print string.group()
>
What's 'workbook'? Don't you mean 'file'?

> workbook.close()
>
>
>
> Here if i will read only once then it is fine and not showing any error.But if i will do it for second time i.e.2nd string i have to search and print both of them,then it is showing error.
>
You haven't shown the traceback, so I have to guess what the error was.

> And one more problem how to append some data to an existing excel sheet by python code.
>
> so can u please help me on this problem.
>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Appending data to an excel sheet by python code Manoj Rout <manojrout70@gmail.com> - 2013-09-14 04:33 -0700
  Re: Appending data to an excel sheet by python code MRAB <python@mrabarnett.plus.com> - 2013-09-14 18:06 +0100
  Re: Appending data to an excel sheet by python code Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-09-14 13:22 -0400
  Re: Appending data to an excel sheet by python code petmertens@gmail.com - 2013-09-14 10:28 -0700

csiph-web