kath wrote:
> Hi,
>
> the following shows the contents of "datebook.xls"
>
> Date
> 8/9/2006
> 8/9/2006
> 8/9/2006
> 8/9/2006
> 8/9/2006
>
> # read_date.py
> import xlrd
>
> book = xlrd.open_workbook("datebook.xls")
> sh = book.sheet_by_index(0)
> ex_qdate=sh.cell_value(rowx=1,colx=0)
> pyd=datetim
Giles Brown wrote:
> John Machin wrote:
> > [EMAIL PROTECTED] wrote:
> > > > > >>> excel_date = 38938.0
> > > > > >>> python_date = datetime.date(1900, 1, 1) +
> > > > > >>> datetime.timedelta(days=excel_date)
&
Ant wrote:
> Look at the following minimal example:
>
> >>> import re
> >>> p = re.compile(r"(:?Test) (String)")
Bzt! Sorry, PBKAC.
The correct syntax is (?:foo)
You have (:?foo)
which matches an optional colon followed by foo.
Now quick kill your post before the effbot spots it :-)
> >>>
Ben wrote:
> Hello...
>
> I have set up a dictionary into whose values I am putting a list. I
> loop around and around filling my list each time with new values, then
> dumping this list into the dictionary. Or so I thought...
>
> It would appear that what I am dumping into the dictionary value is
MonkeeSage wrote:
> On Oct 6, 8:02 pm, "MonkeeSage" <[EMAIL PROTECTED]> wrote:
> > it is clearer to you to make the condition explicit ("blah not False"),
>
> "blah not False" -> "blah is False"
Whichever way your team wants to interpret it, d00d.
Please consider whether you should be writing "(
Aahz wrote:
> In article <[EMAIL PROTECTED]>,
> MonkeeSage <[EMAIL PROTECTED]> wrote:
> >On Oct 6, 6:27 pm, [EMAIL PROTECTED] (Aahz) wrote:
> >>
> >> The following line of lightly munged code was found in a publicly
> >> available Python library...
> >
> >Yes, this violates the Holy, Inspired, Inf
Steve Holden wrote:
> John Machin wrote:
> > Ben wrote:
> >
> >>Hello...
> >>
> >>I have set up a dictionary into whose values I am putting a list. I
> >>loop around and around filling my list each time with new values, then
> &g
Steven D'Aprano wrote:
> On Fri, 06 Oct 2006 18:29:34 -0700, John Machin wrote:
>
> >
> > MonkeeSage wrote:
> >> On Oct 6, 8:02 pm, "MonkeeSage" <[EMAIL PROTECTED]> wrote:
> >> > it is clearer to you to make the condition explicit (&qu
John Roth wrote:
> Aahz wrote:
> > The following line of lightly munged code was found in a publicly
> > available Python library...
> >
> > if schema.elements.has_key(key) is False:
> >
> > Sorry, just had to vent.
> > --
> > Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncra
Chris wrote:
> I need a pattern that matches a string that has the same number of '('
> as ')':
> findall( compile('...'), '42^((2x+2)sin(x)) + (log(2)/log(5))' ) = [
> '((2x+2)sin(x))', '(log(2)/log(5))' ]
> Can anybody help me out?
>
No, there is so such pattern. You will have to code up a func
Lawrence D'Oliveiro wrote:
> In message <[EMAIL PROTECTED]>, Steve
> Holden wrote:
>
> > John Machin wrote:
> >
> > [lots of explanation about peculiarities of people's names]
> >
> > While I don't dispute any of this erudite display of
Lawrence D'Oliveiro wrote:
> In message <[EMAIL PROTECTED]>, John
> Machin wrote:
>
> >
> > Steven D'Aprano wrote:
> >> On Fri, 06 Oct 2006 18:29:34 -0700, John Machin wrote:
> >>
> >> >
> >> > MonkeeSage wrote:
>
Lawrence D'Oliveiro wrote:
> In message <[EMAIL PROTECTED]>, John
> Machin wrote:
>
> >
> > Steven D'Aprano wrote:
> >> On Fri, 06 Oct 2006 18:29:34 -0700, John Machin wrote:
> >>
> >> >
> >> > MonkeeSage wrote:
>
Ben wrote:
> Ah... my list is a string. That explains the len() results, but not why
> it is a string in the dirst place.
>
> I have a dictionary containing a number of instances of the following
> class as values:
>
> class panel:
> mops =[]
>
> def __init__(self,number,level,location,mop
Ben wrote:
> Ah... my list is a string. That explains the len() results, but not why
> it is a string in the dirst place.
>
> I have a dictionary containing a number of instances of the following
> class as values:
>
> class panel:
> mops =[]
>
> def __init__(self,number,level,location,mop
Ben wrote:
> ...and when I print out the string, it is still formatted as one would
> expect a list to be:
>
> "['01', '02', '03', '04']"
>
We know that. Fredrik deduced it and told you well over an hour ago.
Show us the code that is creating instances of the panel class ...
panel1 =
panel(num
Theerasak Photha wrote:
> On 8 Oct 2006 06:12:48 -0700, John Machin <[EMAIL PROTECTED]> wrote:
>
> >
> > Show us the code that is creating instances of the panel class ...
> >
> > panel1 =
> > panel(number=?,level=?,location=?,mops=,mat
Ben wrote:
> Ah - I found out why I had cast it to a string. I had not, at that
> point, worked out ho to pass the list by value rather than reference,
> and so was casting to a string as a stopgap measure that I then forgot
> about. Now the problem is fixed after this group told me how to pass a
Tom Plunket wrote:
> I am building a file with the help of the struct module.
>
> I would like to be able to put Unicode strings into this file, but I'm
> not sure how to do it.
>
> The format I'm trying to write is basically this C structure:
>
> struct MyFile
> {
>int magic;
>int flags;
Peter Otten wrote:
> ygao wrote:
>
> compile('U"中"','c:/test','single')
> >
> d=compile('U"中"','c:/test','single')
> d
> >
> exec(d)
> > u'\xd6\xd0'
> U"中"
> > u'\u4e2d'
>
> >
> > why is the result different?
> > a bug or another reason?
>
> How that particular outp
bruce.who.hk wrote:
> Hi, all
>
> I just donnot know why this is wrong, you can test it in python shell:
>
> class B:
> def __str__(self):
> return u'\u5929\u4e0b'
>
> b=B()
> str(b)
> Traceback (most recent call last):
> File "", line 1, in ?
> UnicodeEncodeError: 'ascii' codec can't
Steve Holden wrote:
>
> Don't forget the UK, where the scots are accommodated by filing Mc
> before Mac everywhere except the 'phone book, where IIRC they are
> treated as equivalent.
Same/similar phone book treatment here in Australia -- Mc is treated as
though it were spelled Mac. An interestin
John J. Lee wrote:
> "John Machin" <[EMAIL PROTECTED]> writes:
> [...]
> > This is all a bit OT. Before we close the thread down
>
> Do you have a warrant for that?
I have some signed-but-otherwise-blank warrants, but I'm saving them
for other threads :-)
kath wrote:
> I have a number of excel files. In each file DATE is represented by
> different name. I want to read the date from those different file. Also
> the date is in different column in different file.
>
> To identify the date field in different files I have created a file
> called _globals
Marc 'BlackJack' Rintsch wrote:
> Because you are trying to compare a unicode string `val` with a byte
> string in the list. The unicode string will be converted to a byte string
> for this comparison with the default encoding: ASCII.
:-)
I presume you must live north of the equator. Down under
[EMAIL PROTECTED] wrote:
> All
>
> I'm a Python newbie, and I'm just getting to the wonders of COM
> programming. I am trying to programmatically do the following:
>
> 1. Activate Excel
> 2. Add a Workbook
> 3. Add a Worksheet
> 4. Populate the new Worksheet
> 5. Repeat steps 3,4 while there
Theerasak Photha wrote:
> I wrote this for someone else to take an object and list of types,
> then check if obj is one of those types, raising an error otherwise.
>
> Is it enough to rely on side effects or absence thereof, or should I
> put return True in here somewhere?
>
> def test_obj_type(obj
Steve Holden wrote:
> John Machin wrote:
> > :-)
[stuff]
> > (-:
> >
> I see you also use little-endian smileys in the antipodes.
>
I was using it in a bracketing manner similar to the Spanish ¿and ¡
except at the other end of the bracketed text. This admittedl
Fredrik Lundh wrote:
> BartlebyScrivener wrote:
> > Fredrik Lundh wrote:
> >
> >> wasting time on broken distributions?
> >
> > It's not broken.
>
> of course it's broken; the official release ships with properly built
> and properly tested versions of the stuff you're struggling to install.
>
> >
js wrote:
> Hello, list.
>
> I have a list of sentence in text files that I use to filter-out some data.
> I managed the list so badly that now it's become literally a mess.
>
> Let's say the list has a sentence below
>
> 1. "Python has been an important part of Google since the beginning,
> and
Matt wrote:
> I am attempting to reformat a string, inserting newlines before certain
> phrases. For example, in formatting SQL, I want to start a new line at
> each JOIN condition. Noting that strings are immutable, I thought it
> best to spllit the string at the key points, then join with '\n'.
kath wrote:
> Hi,
> i am facing some problems with opening an excel file. I am using XLRD
> module.
> I am getting
>
> XLRDError: Can't find workbook in OLE2 compound document
>
> and
>
> CompDocError: Not a whole number of sectors
>
> exceptions in seperate try on different files.
>
> 1.Does any
Michael S wrote:
> Good day all.
>
> I rewrote part of my program in C, it's a usually a
> long task. I wanted to be able to report the progress
> back to my python program. In my module (in addition
> to the function that performs the above-mentioned
> task) there is a function that returns the v
James Stroud wrote:
> George Sakkis wrote:
> > It occured to me that most times I read a csv file, I'm often doing
> > from scratch things like assigning labels to columns, mapping fields to
> > the appropriate type, ignoring some fields, changing their order, etc.
> > Before I go on and reinvent
George Sakkis wrote:
> It occured to me that most times I read a csv file, I'm often doing
> from scratch things like assigning labels to columns, mapping fields to
> the appropriate type, ignoring some fields, changing their order, etc.
> Before I go on and reinvent the wheel, is there a generic h
On 2/11/2006 12:53 AM, Michael S wrote:
> I downloaded Pyrex and ran it through their own
> example. The code looks quite messy, and I even saw a
> few "goto"s.
> I think I will stick with my own code for now.
> Thanks in any case.
If your own code is doing the right amount of reference counting,
Jeff Blaine wrote:
> It's been a year or so since I written Python code, so maybe
> I am just doing something really dumb, but...
>
> Documentation
> =
>
> class DictReader(csvfile[,fieldnames=None,
> [,restkey=None[, restval=None[, dialect='excel'
> [,
Tom Plunket wrote:
> John Machin wrote:
>
> > If you were to write 'c:\temp\book1.csv', it would blow up ... because
> > \t -> tab and \b -> backspace. Get into the habit of *always* using raw
> > strings r'C:\Temp\Book1.csv' for Windows file
On 2/11/2006 2:38 PM, [EMAIL PROTECTED] wrote:
> >> ...alternatively you can just use 'unix slashes', e.g.
> >> 'c:/temp/book1.csv', since those work just fine 'cause the Windows
> >> APIs deal with them properly.
>
> John> Not all APIs do the right thing. If you fire up the cmd.ex
Teja wrote:
> HI all,
>
> I need to write a regular experssion for a string which satisfies the
> following a criteria :
>
> 1) it should start with an alphabet
> 2) it can contain alphabets/digits/_ from second character
> 3) it can contain "[a-z]" or "[0-9]" at the end. but this is optional
Bas
Johanna Pfalz wrote:
> Is there a module/method in python to convert a file from .DBF format to
> .CSV format?
>
>
Hi Johanna, the best start at the moment is the Python Cookbook recipe
that others have quoted. Steps:
(1) Input: as per recipe. Note that the recipe handles only the
earliest simple
GISDude wrote:
> Mike,
> I totally forgot that MS Works was out there. Haven't used that one in
> about 6 or 7 years. Honestly, your best bet is to convert to .csv or
> some delimited .txt file. Once that is done, all your rows/columns will
> be "nice and neat" .
"Nice and neat"? What is that sup
[EMAIL PROTECTED] wrote:
> I have a text file that I am parsing. Each line is of the form:
>
> max_time 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12
>
> The first item is the field name and the next twelve items are values
> for each month in the year. There are multiple lines eac
James Stroud wrote:
[snip]
> I think I'm having some network problems. I'll try again. Also the
> previous "attempt" had a typo (perhaps a freudian slip).
Also this time you replied to the wrong thread :-)
>
> ",".join(some_list).
>
> By the way, don't name your own objects with the names of bui
Paul McGuire wrote:
> "Brandon" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Check out: www.ChezBrandon.com
> >
> By which he means, "do NOT waste your time checking out this ridiculous
> website with absolutely no Python whatever anywhere."
> (This is the idiot who claims he
Thomas W wrote:
> I'm getting really annoyed with python in regards to
> unicode/ascii-encoding problems.
>
> The string below is the encoding of the norwegian word "fødselsdag".
>
> >>> s = 'f\xc3\x83\xc2\xb8dselsdag'
There is no such thing as "*the* encoding" of any given string.
>
> I stored t
Robert Kern wrote:
> However, I don't know of an encoding that takes u"fødselsdag" to
> 'f\xc3\x83\xc2\xb8dselsdag'.
There isn't one.
C3 and C2 hint at UTF-8.
The fact that C3 and C2 are both present, plus the fact that one
non-ASCII byte has morphoploded into 4 bytes indicate a double whammy.
Thomas W wrote:
> Ok, I've cleaned up my code abit and it seems as if I've
> encoded/decoded myself into a corner ;-). My understanding of unicode
> has room for improvement, that's for sure. I got some pointers and
> initial code-cleanup seem to have removed some of the strange results I
> got, w
Andrea Griffini wrote:
> John Machin wrote:
>
> > The fact that C3 and C2 are both present, plus the fact that one
> > non-ASCII byte has morphoploded into 4 bytes indicate a double whammy.
>
> Indeed...
>
> >>> x = u"fødselsdag"
> >>>
Gabriel Genellina wrote:
> At Monday 6/11/2006 20:34, Robert Kern wrote:
>
> >John Machin wrote:
> > > Indeed yourself. Have you ever considered reading posts in
> > > chronological order, or reading all posts in a thread?
> >
> >That presumes that
M.N.Smadi wrote:
> Hi there;
>
> i have a script that is not indented properly. Is there a way that i can
> have it auto indented.
It depends on what you mean by "not indented properly". Indentation is
part of the Python grammar.
If the script compiles OK, and works as expected, but you have (say
Cameron Laird wrote:
> In article <[EMAIL PROTECTED]>,
> John Machin <[EMAIL PROTECTED]> wrote:
> >
> >Thomas W wrote:
> >> Ok, I've cleaned up my code abit and it seems as if I've
> >> encoded/decoded myself into a corner ;-). My understa
[EMAIL PROTECTED] wrote:
> Can Python not express the idea of a three-byte int?
It is a bit hard to determine what that (rhetorical?) question means.
Possible answers:
1. Not as concisely as a one-byte struct code -- as you presumably have
already determined by reading the manual ...
2. No, but wh
timmy wrote:
> Hello,
>
> has anybody got any experience opening and manilpulating excel
> spreedsheets via python? it seems pythoncom allows this to happen but
> i'm a total newb to it. (i usually work in the unix world)
> all i need to do, is open the xls files and read values from it.
If you r
srj wrote:
> hi
> can any1 tell me which is a good imaging lib in python and where i can
> get it (2 dwnld) from??
>
> regds
The straight answer to your question is "Yes".
If you were to do a google search for "python imaging library", you
would then be in a position to tell yourself.
--
http:
Bruno Desthuilliers wrote:
> Gabriel Genellina wrote:
> > At Wednesday 8/11/2006 22:29, zeal elite wrote:
> >
> >> I am looking for substring search python program without using the
> >> built in funtions like find, or 'in'.
> >
> > The only reasonable usage for such a constraint would be a school
Dave Opstad wrote:
> Sorry, that should have been:
>
> cdb += struct.pack(">L", skip)[1:]
>
">L" and ">I" produce exactly the same 4-byte result. The change from
[-3:] to [1:] is a minor cosmetic improvement, but obscures the
underlying ... a bit like putting mascara on a pig. I got the
impressio
Steven D'Aprano wrote:
> On Thu, 09 Nov 2006 03:31:02 -0800, John Machin wrote:
>
> >
> > Bruno Desthuilliers wrote:
> >> Gabriel Genellina wrote:
> >> > At Wednesday 8/11/2006 22:29, zeal elite wrote:
> >> >
> >> >> I am look
wesley chun wrote:
> > has anybody got any experience opening and manilpulating excel
> > spreedsheets via python? it seems pythoncom allows this to happen
>
>
> i posted a couple of snippets along with others in this earlier thread:
>
> http://groups.google.com/group/comp.lang.python/browse_threa
Matthias Winterland wrote:
> Hi,
>
> I have a simple question. When I read in a string like:
> a='1,2,3,4,5 6 7,3,4', can I get the list l=[1,2,3,4,5,6,7,3,4] with a
> single split-call?
>
Using str method split, no -- as documented [hint!], it provides only a
single separator argument.
Using re.
[EMAIL PROTECTED] wrote:
> > Not as concisely as a one-byte struct code
>
> Help, what do you mean?
Help, what did you mean by the question?
"struct" == "Python struct module"
Struct module has (concise) codes B, H, I, Q for unsigned integers of
lengths 1, 2, 4, 8, but does *not* have a code for
[EMAIL PROTECTED] wrote:
> > "struct" == "Python struct module"
> >
> > Struct module has (concise) codes B, H, I, Q for unsigned integers of
> > lengths 1, 2, 4, 8, but does *not* have a code for 3-byte integers.
>
> I thought that's what the manual meant, but I was unsure, thank you.
If it does
[EMAIL PROTECTED] wrote:
>
> Pack ' these things.
>
> The people who wrote this stuff forty years ago were thinking of bit
> fields - here bit lengths of 8 then 3 then 21 then 8 then 8 bits -
> cheating only when the bit boundaries happened to hit byte boundaries.
>
> Yes, as you describe in thi
[EMAIL PROTECTED] wrote:
> Speaking as the OP, perhaps I should mention:
>
> > > [-3:] to [1:] is a minor cosmetic improvement
>
> To my eye, that's Not an improvement.
>
> '\x08' '\x01\x23\x45' '\x80' '\0' is the correct pack of (0x08,
> 0x12345, 0x80, 0) because '\x01\x23\x45' are the significan
Podi wrote:
> As far as I know, there is pyXLWriter for writing and xlrd for reading.
Most folk would seem to be using pyExcelerator rather than pyXLWriter.
It is much more up to date, it just hasn't been worked on for a year,
whereas pyXLWriter is obsolete (doesn't write latest Excel file format
Neil Cerutti wrote:
> On 2006-10-16, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > here is something that surprises me.
> >
> > #coding: iso-8859-1
>
> I think that's supposed to be:
>
> # -*- coding: iso-8859-1 -*-
>
Not quite. As PEP 263 says:
"""
More precisely, the first
Jorge Vargas wrote:
> On 9 Nov 2006 16:44:40 -0800, gavino <[EMAIL PROTECTED]> wrote:
> > both are interpreted oo langauges..
> >
> that is not correct java is compiled and the VM interprets the code
... and what do you think is in those pesky little .pyc files you may
have noticed lying arou
Podi wrote:
>
> >
> > 2. OpenOffice.org has a built-in Python -- 2.n where n is a small
> > number :-( and almost impenetrable documentation -- Sybren Stuvel has
> > published some examples: http://www.stuvel.eu/ooo-python
> > but my guess is that all the users of the OOo interface could fit in a
ronrsr wrote:
> the exact code that is triggering the error message is:
>
> zc = zsql.connect()
Don't give us one line; give us the whole of the imported module plus
the calling script (at least up to the place where it gets the error).
That way we can see what is really going on, and someone wit
Jorge Vargas wrote:
> On 9 Nov 2006 18:09:37 -0800, John Machin <[EMAIL PROTECTED]> wrote:
> >
> > Jorge Vargas wrote:
> > > On 9 Nov 2006 16:44:40 -0800, gavino <[EMAIL PROTECTED]> wrote:
> > > > both are interpreted oo langauges..
> >
Steven D'Aprano wrote:
> On Sun, 12 Nov 2006 02:31:04 +0100, Fredrik Lundh wrote:
>
> >> For example, I have a ZIP code
> >> database that can do some processing on its numbers, and the numbers are
> >> stored as floating point values (exactly) but Python doesn't get them
> >> right
> >
> > sounds
Ben Finney wrote:
> "ronrsr" <[EMAIL PROTECTED]> writes:
>
> > #row is a dictionary with keys: zid, keywords, citation, quotation
> > def print_row(row):
> >print """
> > %(keywords)s
> >
> > %(quotation)s
> >
> > %(citation)s
> >
> >> name="updat
ronrsr wrote:
> I think I am passing the wrong argument to the Print_row routine:
Well, yes, that is what the error message is telling you.
It is also what Fredrik Lundh told you only a couple of hours ago.
He also told you what to do to fix it, at a high level.
Below is my attempt to explain at
[EMAIL PROTECTED] wrote:
> If you are looking for an example of jython there is one in embeded in
> csound blue. available from the csounds.com website I believe. I have
> used it under the new java framework. I am not far enough along to
> know if you are missing brackets {} exc and () and one
Antoon Pardon wrote:
> I have a text in ascii. I use the ' for an apostroph. The problem is
> this gives problems with the title method. I don't want letters
> after a ' to be uppercased. Here are some examples:
>
>argument result expected
>
> 't smidje 'T Smidje '
kath wrote:
> Hi all,
>
> Platform:winxp
> Version: Python 2.3
>
> I have a task of reading files in a folder and creating an one excel
> file with sheets, one sheet per file, with sheet named as filename. I
> am facing problem in handling special characters. I am using XLRD
[EMAIL PROTECTED] wrote:
> I've been working on some code to search for specific textstrings and
> act upon them insome way. I've got the conversion sorted
What does that mean? There is no sort in the computer sense, and if you
mean as in "done" ...
> however there
> is 1 problem remaining.
>
> I
John Machin wrote:
>new = line[:-1] + "===\n"
To allow for cases where the last line in the file is not terminated
[can happen],
this should be:
new = line.rstrip("\n") + "===\n"
# assuming you want to fix the unterminated problem.
Cheers,
John
-
[EMAIL PROTECTED] wrote:
> Thanks Fredrik, Peter and John for your help.
>
> John, I especially enjoyed your line by line assasination of my code,
> keep it up.
>
> I'm not a programmer, I dislike programming, I'm bad at it. I just
> agreed to do this to help someone out, I didn't even know what p
Fredrik Lundh wrote:
> After incorporating more than 60 comments, adding a bunch of new
> articles, and having made a ludicrous amount of minor edits and
> tweaks, I'm happy to announce a first "beta" release of the new
> Python FAQ:
>
> http://effbot.org/pyfaq/
>
> Many thanks to everyone who
On 16/11/2006 8:57 AM, Terry Reedy wrote:
> "John Salerno" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> John Machin wrote:
>>
>>> Here in Austraila, (I expect this is common to most countries), there
>>> are people who ar
On 16/11/2006 5:45 PM, olive wrote:
> dwelch91 a écrit :
>> http://docs.python.org/ref/yield.html
>
> This is a perfect example that demonstrate how the actual python is bad
> and most of the time useless (at least for me).
I think that you left the word "documentation" out after "python" :-)
>
On 16/11/2006 7:00 PM, Fredrik Lundh wrote:
> John Machin wrote:
>
>>> I would like to thanks Fredrik for his contribution to improve that.
>>
>> Call me crazy, but after an admittedly quick read, the version on the
>> wiki seems to be about word for word wi
Fredrik Lundh wrote:
> robert wrote:
>
> > What is a most simple expression for splitting a CSV line
> > with "-protected fields?
> >
> > s='"123","a,b,\"c\"",5.640'
>
> import csv
>
> the preferred way is to read the file using that module. if you insist
> on processing a single line, you can do
John Machin wrote:
> Fredrik Lundh wrote:
> > robert wrote:
> >
> > > What is a most simple expression for splitting a CSV line
> > > with "-protected fields?
> > >
> > > s='"123","a,b,\"c\"",5.640'
&g
John Machin wrote:
> John Machin wrote:
> > Fredrik Lundh wrote:
> > > robert wrote:
> > >
> > > > What is a most simple expression for splitting a CSV line
> > > > with "-protected fields?
> > > >
> > > > s=
Fredrik Lundh wrote:
> John Machin wrote:
>
> > Given Peter Otten's post, looks like
> > (1) there's a bug in the "fmtparam" mechanism -- it's ignoring the
> > escapechar in my first twiddle, which should give the same result as
> > Pe
ronrsr top-posted [uncorrected]:
> very sorry, that was my error - len(result[0]) and len(result[1]) both
> return 1 --
>
> i think I'm misunderstanding what len() does - to me they appear to
> have 2 or 3 elements, or at least be composed of a string of some
> length.
len(result) is 248 because y
John Henry wrote:
> I am just wondering what's with get_close_matches() in difflib. What's
> the magic? How fuzzy do I need to get in order to get a match?
Are you desperate to understand the inner workings of difflib, or do
you want merely to do some fuzzy matching of strings using a well-kno
[EMAIL PROTECTED] wrote:
> I can't understand a little thing in bitwise operations.
>
>
> In PHP and Javascript
> 4653896912>>13 = -212992
>
> In Python and Ruby
> 4653896912>>13 = 568102
>
> In Python and Ruby - it's ok. I understand.
> But i need to get in Python same value as in PHP and Javascr
On Nov 17, 9:38 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> John Machin wrote:
> >http://theopensourcery.com/phplogic.htm
>
> > "In effect the bitwise operations [words "can be" omitted, I presume]"can
> > only be", more likely.
Ye
On Nov 17, 9:18 pm, Johan von Boisman <[EMAIL PROTECTED]> wrote:
> I missed the beginning of this thread, but why not write
>
> s = u"äÄöÖüÜß"
>
> Is there ever a reason _not_ to exclusively use the unicode stringtype
> throughout your Python program? (of course you may need to encode/decode
> wh
On 29/05/2006 5:23 AM, Brendan wrote:
> Thanks John. I've discovered that datetime.strptime will be available
> in 2.5, (http://docs.python.org/dev/whatsnew/modules.html) but your
> example will work in the meantime.
>
Only in the meantime? I would thought there was a good chance it would
cont
On 29/05/2006 6:27 AM, Gerard Flanagan wrote:
> I don't think it's what you want but I had the following on file - it
> uses time.strptime() which I didn't know there was a problem with.
In 2.3, time.strptime became a pure-Python routine, thus losing its
dependency on the existence and correctn
On 29/05/2006 7:46 AM, Sébastien Boisgérault wrote:
> Paddy a écrit :
>
>> maybe this: http://www.pcre.org/pcre.txt and ctypes might work for you?
>
> Well finally, it doesn't fit. What I need is a "longest match" policy
> in
> patterns like "(a)|(b)|(c)" and NOT a "left-to-right" policy.
> Addit
On 29/05/2006 4:14 AM, [EMAIL PROTECTED] wrote:
> Is there any chance of itertools.count() ever becoming one of the
> built-in functions? It's a wonderful little function and I find myself
> importing it in every module I write.
>
Every module?? Do you use any/many other itertools functions? Care
On 29/05/2006 9:50 AM, [EMAIL PROTECTED] wrote:
> I have a project of around 6000 lines where I used count() 20 times. It
> has 14 modules, 10 of which I needed an explicit import.
>
> Many of the usages are of the form:
>
> for item, n in zip(items, count(N)):
> dostuff
>
> Around half of thes
On 30/05/2006 2:57 AM, DurumDara wrote:
> Hi !
>
> I need to speedup my MD5/SHA1 calculator app that working on
> filesystem's files.
> I use the Python standard modules, but I think that it can be faster if
> I use C, or other module for it.
>
> I use FSUM before, but I got problems, because I
On 29/05/2006 10:47 PM, Serge Orlov wrote:
> Rocco wrote:
>> Also with ascii the function does not work.
>
> Well, at least you fixed misconfiguration ;)
>
> Googling for 1F8B (that's two first bytes from your strange python 2.4
> result) gives a hint: it's a beginning of gzip stream.
Well done!
On 30/05/2006 12:44 AM, Rocco wrote:
> Thanks Serge.
> It's a gzip string.
Look, Ma, no gzip!!!
C:\junk>rocco_rss.py
'NF
E/1.0type rocco_rss.py
import urllib2
def takefeed(url):
request=urllib2.Request(url)
request.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE
5.5; Wi
601 - 700 of 3076 matches
Mail list logo