Skip Montanaro writes:
> How about just replacing *\(([^)]*)\)* with *"\1"* in a wrapper class's
> line reading method? (I think I have the re syntax approximately right.)
> The csv reader will "just work". Again, nesting parens not allowed.
>
> Skip
here is some working code:
def PReader(csvfi
> Besides, the point isn't the shortest code but to illustrate the idea
> of handling special syntax.
In my defense, I was typing on my phone while watching a show on
Netflix. I was hardly in a position to test any code. :-)
As you indicated though, the problem is under-specified (nesting?,
pres
On 24Sep2019 19:02, Skip Montanaro wrote:
How about just replacing *\(([^)]*)\)* with *"\1"* in a wrapper class's
line reading method?
Will that work if the OP's (TEST1,TEST2) term itself contains quotes?
Not that his example data did, but example data are usually incomplete
:-)
Also, tha
How about just replacing *\(([^)]*)\)* with *"\1"* in a wrapper class's
line reading method? (I think I have the re syntax approximately right.)
The csv reader will "just work". Again, nesting parens not allowed.
Skip
--
https://mail.python.org/mailman/listinfo/python-list
On 2019-09-25 00:09, Cameron Simpson wrote:
On 24Sep2019 15:55, Mihir Kothari wrote:
I am using python 3.4. I have a CSV file as below:
ABC,PQR,(TEST1,TEST2)
FQW,RTE,MDE
Really? No quotes around the (TEST1,TEST2) column value? I would have
said this is invalid data, but that does not help yo
On 24Sep2019 15:55, Mihir Kothari wrote:
I am using python 3.4. I have a CSV file as below:
ABC,PQR,(TEST1,TEST2)
FQW,RTE,MDE
Really? No quotes around the (TEST1,TEST2) column value? I would have
said this is invalid data, but that does not help you.
Basically comma-separated rows, where
As csv.reader does not suport utf-8 encoded files, I'm using:
fp = codecs.open(arquivoCSV, "r", "utf-8")
self.tab=[]
for l in fp:
l=l.replace('\"','').strip()
self.tab.append(l.split(','))
It works much better except that when I do self.sel.type("q", ustring)
where ustring is a unicode st
En Tue, 15 Dec 2009 19:12:01 -0300, Emmanuel escribió:
Then my problem is diferent!
In fact I'm reading a csv file saved from openoffice oocalc using
UTF-8 encoding. I get a list of list (let's cal it tab) with the csv
data.
If I do:
print tab[2][4]
In ipython, I get:
equação de Toricelli. Ta
Then my problem is diferent!
In fact I'm reading a csv file saved from openoffice oocalc using
UTF-8 encoding. I get a list of list (let's cal it tab) with the csv
data.
If I do:
print tab[2][4]
In ipython, I get:
equação de Toricelli. Tarefa exercícios PVR 1 e 2 ; PVP 1
If I only do:
tab[2][4]
On Tue, Dec 15, 2009 at 4:24 PM, Emmanuel wrote:
> I have a problem with csv.reader from the library csv. I'm not able to
> import accentuated caracters. For example, I'm trying to import a
> simple file containing a single word "equação" using the following
> code:
>
> import csv
> arquivoCSV='te
On Tue, Dec 15, 2009 at 1:24 PM, Emmanuel wrote:
> I have a problem with csv.reader from the library csv. I'm not able to
> import accentuated caracters. For example, I'm trying to import a
> simple file containing a single word "equação" using the following
> code:
>
> import csv
> arquivoCSV='te
Mike P wrote:
I'm trying to use the CSV module to read in some data and then use a
hashable method (as there are millions of records) to find unique ids
and push these out to another file,
You could either zip with a counter or use the uuid module,
depending on just how unique you want your ids
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:python-
> [EMAIL PROTECTED] On Behalf Of Mike P
> Sent: Tuesday, February 12, 2008 5:37 AM
> To: python-list@python.org
> Subject: Re: CSV Reader
>
> just saw i needed to change record.startswith to row.st
En Tue, 12 Feb 2008 08:37:13 -0200, Mike P
<[EMAIL PROTECTED]> escribi�:
> just saw i needed to change record.startswith to row.startswith
> but i get hte following traceback error
>
> Traceback (most recent call last):
> File "C:\Python25\Lib\site-packages\pythonwin\pywin\framework
> \scriptu
I was just trying to do it with the CSV module
--
http://mail.python.org/mailman/listinfo/python-list
Hi Chris that's exactley what i wanted to do,
Many thanks
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 12, 12:21 pm, Mike P <[EMAIL PROTECTED]> wrote:
> I did just try to post, but it doesn't look like it has appeared?
>
> I've used your advice Andrew and tried to use the CSV module, but now
> it doesn't seem to pick up the startswith command?
> Is this because of the way the CSV module is re
just saw i needed to change record.startswith to row.startswith
but i get hte following traceback error
Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\pythonwin\pywin\framework
\scriptutils.py", line 310, in RunScript
exec codeObject in __main__.__dict__
File "Y:\te
I did just try to post, but it doesn't look like it has appeared?
I've used your advice Andrew and tried to use the CSV module, but now
it doesn't seem to pick up the startswith command?
Is this because of the way the CSV module is reading the data in?
I've looked into the module description but i
En Mon, 11 Feb 2008 14:41:54 -0200, Mike P
<[EMAIL PROTECTED]> escribi�:
> CSV_Data = open(working_CSV)
> data = CSV_Data.readlines()
> flag=False
> for record in data:
> if record.startswith('"Transaction ID"'):
> [...]
Files are already iterable by lines. There is no need to use readl
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:python-
> [EMAIL PROTECTED] On Behalf Of Mike P
> Sent: Monday, February 11, 2008 11:42 AM
> To: python-list@python.org
> Subject: Re: CSV Reader
>
> Cheers for the help, the second way looked to be the best
Cheers for the help, the second way looked to be the best in the end,
and thanks for the boolean idea
Mike
working_CSV = "//filer/common/technical/Research/E2C/Template_CSV/
DFAExposureToConversionQueryTool.csv"
save_file = open("//filer/common/technical/Research/E2C/Template_CSV/
CSV_Data2.c
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:python-
> [EMAIL PROTECTED] On Behalf Of Mike P
> Sent: Monday, February 11, 2008 11:10 AM
> To: python-list@python.org
> Subject: Re: CSV Reader
>
> Hi Larry,
>
> i'm still getting to grips wit
Hi Larry,
i'm still getting to grips with python, but rest assured i thinkn it's
better for me to write hte code for learnign purposes
My basic file is here, it comes up with a syntax error on the
startswith line, is this because it is potentially a list?
My idea was to get the lines number where
Mike P wrote:
> Hi All,
>
> I want to read in a CSV file, but then write out a new CSV file from a
> given line..
>
> I'm using the CSV reader and have the the line where i want to start
> writing the new file from begins with
> "Transaction ID",
>
> i thought it should be something along the li
25 matches
Mail list logo