Randy Bush wrote:
> a dict written as
>
>pKey = (prefix, pLen, origin)
>
>val = dict.get(pKey)
>if val == None:
> dict[pKey] = (timeB, timeB)
>else:
> if val[0] > timeB: val[0] = timeB
> if val[1] < timeB: val[1] = timeB
> dict[pKey] = val
>
> and read b
Grant Edwards wrote:
> On 2005-08-18, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>>i have an ascii string comming in the serial port and i need to convert
>>it to something else, like an integer, or binary, or even a hex so i
>>can use the bitwise comparison on it.
Nephish, *WHY* do want t
googleboy wrote:
> I've written a little script to parse a csv file then use seach/replace
> over a template to create a file for each line in the file. It pikes
> out when I call the function that parses the csv (read_revs). If I
> have inadvertantly left an extra comma or two in the comma field
Greg McIntyre wrote:
> I have a Python snippet:
>
> f = open("blah.txt", "r")
> while True:
> c = f.read(1)
> if c == '': break # EOF
That could read like this
if not c: break # EOF
# see below for comments on what is true/false
> # ... work on c
>
> Is some way to make th
Bengt Richter wrote:
> On 18 Aug 2005 22:21:53 -0700, "Greg McIntyre" <[EMAIL PROTECTED]> wrote:
>
>
>>I have a Python snippet:
>>
>> f = open("blah.txt", "r")
>> while True:
>> c = f.read(1)
>> if c == '': break # EOF
>> # ... work on c
>>
>>Is some way to make this code more compact
[EMAIL PROTECTED] wrote:
> Alright, everyone seems to have gone off on a tangent here, so I'll try
> to stick to your code...
> """
> This is what I would ideally like:
>
>
> f = open("blah.txt", "r")
> while c = f.read(1):
> # ... work on c
>
>
> But I get a syntax error.
>
>
>
Tom Strickland wrote:
> I have a file that contains many lines, each of which consists of a string
> of comma-separated variables, mostly floats but some strings. Each line
> looks like an obvious tuple to me. How do I save each line of this file as a
> tuple rather than a string? Or, is that th
limodou wrote:
> 2005/8/19, max(01)* <[EMAIL PROTECTED]>:
>
>>hi.
>>
>>i was wondering, what's the simplest way to echo the standard input to
>>the standard output, with no modification.
>>
>>i came up with:
>>
>>...
>>while True:
>> try:
>> raw_input()
>> except EOFError:
>> break
>>.
David Fickbohm wrote:
> People,
>
> I am trying to determine the creation date of files in a folder.
> I am using the following code to find the folder and confirm that files
> exist in the folder.
Presumably you meant "intend to use the following pseudocode" (not "am
using the following code")
Reinhold Birkenfeld wrote:
> John Machin wrote:
>
>
>>... AND it's about time that list is updated to include False explicitly
>> -- save nitpicking arguments about whether False is covered by
>>"numeric zero of all types" :-)
>
>
> Don
wen wrote:
> and, in which case, the following case will happen:
> if __name__!='__main__':
> do_sth()
>
> any help would be appreciated.
>
>
Sorry, but your question is rather difficult to interpret.
For a start, you don't need/want to import __main__.
On import, __name__ is set to the na
Greg McIntyre wrote:
> John Machin wrote:
>
>>How about
>>for c in f.read():
>>?
>>Note that this reads the whole file into memory (changing \r\n to \n on
>>Windows) ... performance-wise for large files you've spent some memory
>>but clawed back
[EMAIL PROTECTED] wrote:
> I have a text file with many hundreds of lines of data. The data of
> interest to me, however, resides at the bottom of the file, in the last
> 20 lines. Right now, I read the entire file and discard the stuff I
> don't need. I'd like to speed up my program by reading onl
Googling for "pickle array" in comp.lang.python yields old messages that
show a PickleError -- plus one message where Alex Martelli writes "I am
but an egg" :O)
Looks like arrays are NOW (2.4.1) pickleable but not unpickleable -- see
below.
I appreciate that arrays are inherently not pickleable
Peter Hansen wrote:
> Carsten Haese wrote:
>
>> On Fri, 2005-09-02 at 16:46, Laguna wrote:
>>
>>> def expiration(year, month):
>>> weekday = calendar.weekday(year, month, 1)
>>> table = [19, 18, 17, 16, 15, 21, 20]
>>> return table[weekday]
>>>
>> This, of course, can be "optimized" in
Gregor Horvath wrote:
> Hi,
>
> given the dynamic nature of python I assume that there is an elegant
> solution for my problem, but I did not manage to find it.
>
> I have a file that contains for example on line:
> ['147', '148', '146']
> when I read the file
> f = file("I050901.ids").readline
Terry Reedy wrote:
>>Laguna wrote:
>>
>>>I want to find the expiration date of stock options (3rd Friday of the
>>>month) for an any give month and year.
>
>
>>From year and month (and day=1) get the day of the week (n in [0,6]) of the
> first of the month using some version of the the standard
Francis Girard wrote:
> Hi,
>
> I think your last solution is not good unless your "list" is sorted
(in which
> case the solution is trivial) since you certainly do have to see all
the
> elements in the list before deciding that a given element is not a
duplicate.
> You have to exhaust the iterata
Gabriel Cooper wrote:
> Jussi Jumppanen wrote:
>
> >The latest release of the Zeus for Windows programmer's
> >editor is now available.
> >
> So is this mentioned here on the Python mailing list because Zeus was
> written in Python, or is this just targeted spam for a commerical
product?
Targete
Jean de Largentaye wrote:
> Hi,
>
> I need to parse a subset of C (a header file), and generate some unit
> tests for the functions listed in it. I thus need to parse the code,
> then rewrite function calls with wrong parameters. What I call
"shaking
> the broken tree" :)
I was thinking "cdecl",
jose isaias cabrera wrote:
> > the question is, how can I make this java (byte) call in python? so
that the
> result would be the right one, "[EMAIL PROTECTED]"
>
Let's get this straight: you have 40 hex digits; both your Java code
and your Python code each do 20 iterations, printing the 20 bytes
[EMAIL PROTECTED] (Mark Jackson) wrote in message news:<[EMAIL PROTECTED]>...
>
> A: 42
>
> Q: What multiple of 7 did I add to the critical expression in the Zeller
> algorithm so it would remain nonnegative for the next few centuries?
What are you calling "the Zeller algorithm", and what
Dan Perl wrote:
> <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hello All,
> > What is the python equivalent of the following statement?
> >
> > while (n--)
>
> Like other posters said, you should give more details with your
question.
> What do you mean by equivalent? The foll
administrata wrote:
> Is it possible?
>
> I tried...
>
>
> I = "John"
> print \
> """
> I used to love pizza"""
>
>
> Error occurs!!!
>
> But, I don't know how to fix... HELP
>
> thx 4 reading.
Point 0: It helps if you post a copy of what the actual screen display
looked like, instead of just sayi
Michael Hartl wrote:
> I warmly recommend downloading Peter Norvig's Python utilities file
> (http://aima.cs.berkeley.edu/python/utils.py) and putting it on your
> Python path. (E.g., in bash, put a line like
>
> export PYTHONPATH="/path/to/utilities_directory"
>
> in your .bashrc file.) The uti
MM wrote:
> Hi,
>
> I downloaded the latest win32all build 202 and tried to install under
> win2000 with Py2.4. Install complains about 'couldn't open py2.4 to
run
> script pywin32-preinstall.py'. I checked the directories and there
was
> no sign of this file (preinstall.py) so I presume this is
vegetax wrote:
> How can i make my custom class an element of a set?
>
> the idea is that it accepts file paths and construct a set of unique
> files (the command "cmp" compares files byte by byte.),the files can
> have different paths but the same content
>
Q: How do I transport ten sumo wrestle
On 16 Feb 2005 18:47:21 GMT, Leo Breebaart <[EMAIL PROTECTED]> wrote:
>
>What I can't find an explanation for is why str.join() doesn't
>automatically call str() on its arguments, so that e.g.
>str.join([1,2,4,5]) would yield "1245", and ditto for e.g.
>user-defined classes that have a __str__()
On Wed, 16 Feb 2005 14:24:02 -0600, Skip Montanaro <[EMAIL PROTECTED]>
wrote:
>
>John> 4. For consistency, would you like "1" + 2 to produce "12"?
>
>No, the correct answer is obviously 3. ;-)
>
Obviously, in awk. Bletch! I once had to help out some users of a
system where software developmen
On Wed, 16 Feb 2005 20:57:18 -0500, Scott
<[EMAIL PROTECTED]> wrote:
>I've installed Python 2.4 under WinXP and am attempting to
>create an extension module using the steps outlined here:
>http://python.org/doc/2.4/ext/win-cookbook.html
>
>I'm specifically trying to perform step 6. Creating a bran
James Stroud wrote:
>
> It seems I need constructs like this all of the time
>
> i = 0
> while i < len(somelist):
> if oughta_pop_it(somelist[i]):
> somelist.pop(i)
> else:
> i += 1
>
> There has to be a better way...
>
! for i in xrange(len(somelist)-1, -1, -1):
! if oughta_pop_it
Diez B. Roggisch wrote:
> So I'd suggest you dump re and do it like this:
>
> address = "192.168.1.1"
>
> def validate_ip4(address):
> digits = address.split(".")
> if len(digits) == 4:
> for d in digits:
> if int(d) < 0 or int(d) > 255:
> return Fals
Diez B. Roggisch wrote:
>
> You could use another regular expressin, e.g. like this:
>
>
> rex = re.compile(r"^((\d)|(1\d{1,2})|(2[0-5]\d))$")
This approach would actually work without the need for subsequent
validation, if implemented properly. Not only as you noted does it let
"259" through, bu
Steven Bethard wrote:
> I have a list of dictionaries. Each dictionary holds counts of
various
> 'words', e.g.:
> Basically, I use a greedy approach -- adding a dict each time if I
can.
> This leads to some suboptimal solutions given that, while the total
> counts must not exceed MAX_VALUE, I
John Lenton wrote:
> On Thu, Feb 17, 2005 at 03:46:20PM -0800, Xah Lee wrote:
> > here's another interesting algorithmic exercise, again from part of
a
> > larger program in the previous series.
> >
> > Here's the original Perl documentation:
> >
> > =pod
> >
> > merge($pairings) takes a list of p
John Lenton wrote:
> On Fri, Feb 18, 2005 at 03:21:10PM -0800, John Machin wrote:
> > Not robust in the face of input like:
> > [[1,1]]
> > or
> > [[1,2], [1,2]]
> > or
> > [[1,2], [2,1]]
> > or
> > [[1,2], [2,3], [3,1]]
>
> oops, my
John Lenton wrote:
> On Fri, Feb 18, 2005 at 04:52:46PM -0800, John Machin wrote:
> > > > needs "if rev[first] == rev[second]: continue" here
> > >
> > > an 'is' is enough, and better.
> >
> > Good point. You're redeeming your
Reinhold Birkenfeld wrote:
> Xah Lee wrote:
> > here's the answer to the partition by equivalence exercise.
>
> Your Python solution is, as expected, wrong (try with
> [[10, 8], [7, 3], [1, 7], [5, 4], [2, 2], [3, 8], [7, 10], [2, 3],
[6,
> 10], [3, 2]]
> for example).
>
> The solution by John Len
On 19 Feb 2005 17:56:27 -0800, [EMAIL PROTECTED] wrote:
>John Machin>FWIW, here's a brief UAT report:
>
>Here is something else for you.
>Note: for more correct comparisons, for the following tests I've
>disabled the use of Psyco in Graph (usually enabled, if prese
[EMAIL PROTECTED] wrote:
> O/S: Windows XP Service Pack 2
> Python version: 2.4
>
> Unable to understand how to build a class to handle an exception.
>
> Contents of sample01.py:
> import exceptions
> class SampleMain:
> try:
> def __init__(self):
> print 'in SampleMain con
Xah Lee wrote:
> when i try to run the following program, Python complains about some
> global name frozenset is not defined. Is set some new facility in
> Python 2.4?
http://www.python.org/doc/2.3/whatsnew/
http://www.python.org/doc/2.4/whatsnew/whatsnew24.html
You must be running 2.3. If you p
On 20 Feb 2005 03:31:33 -0800, [EMAIL PROTECTED] wrote:
>John Machin:
>>FWIW, my offering is attached. <
>
>I'm sorry, I don't see the attach... (just the different title).
>
Here it is. I'll reply to the rest tomorrow. It's way past sleep-time
h
[EMAIL PROTECTED] wrote:
> Hi,
> I have 2 lists of tuples that look like:
> E1=[('a','g'),('r','s')] and
> E2=[('g','a'),('r','q'),('f','h')].
> In this tuple, the ordering does not
> matter, i.e. (u,v) is the same as (v,u).
>
> What I want to do is the following:
> given 2 list of tuples, E1 and
Reinhold Birkenfeld wrote:
> Reinhold Birkenfeld wrote:
>
> > My solution (which may not be the fastest or most effective, but
till
> > now is the shortest and it works):
[snip RB]
>
> A recursive solution (around twice as fast as the above, though very
> slow still...)
>
[snip RB2]
>
> Another
Eric Pederson wrote:
> > From: "Xah Lee" <[EMAIL PROTECTED]>
> > ©for group in interm:
> what do the funny little "©"s stand for?
...>>> import unicodedata as ucd; ucd.name('©'.decode('cp1252'))
'COPYRIGHT SIGN'
Xah is asserting his right to be recognised as the author of his
artistic creati
Steve M wrote:
> Hello,
>
> I'm trying to figure out the index position of a tuple
member.
> I know the member name, but I need to know the members index
position.
Tuples, like lists, don't have members in the sense that they can be
"named" like t.foo. The only way of referring to them is
Steve M wrote:
> I'm actually doing this as part of an exercise from a book. What the
program
> is supposed to do is be a word guessing game. The program automaticly
> randomly selects a word from a tuple.
Care to tell us which book is using a tuple for this, but hasn't got to
lists yet?
Cheers,
Pierre Quentel wrote:
> Another method is to build two sets of sets, one for E1 and one for
E2,
> then make the intersection of these sets
>
> - with Python 2.3
>
> >>> E1=[('a','g'),('r','s')]
> >>> E2=[('g','a'),('r','q'),('f','h')]
> >>> from sets import Set,ImmutableSet
> >>> f=Set([Immuta
Steve M wrote:
> John Machin wrote:
>
> >
> > Steve M wrote:
> >> I'm actually doing this as part of an exercise from a book. What
the
> > program
> >> is supposed to do is be a word guessing game. The program
automaticly
> >> randomly se
Frans Englich wrote:
> This is silly. How do I access data files I've installed with
distutils? In a
> portable, generic way, I want to find out what is the following path
on most
> systems:
>
> /usr/local/lib/python2.4/lib/site-packages/foo/bar.txt
Most systems? A tad *nix-centric, yes/no?
>
>
Lowell Kirsh wrote:
> I have a script which I use to find all duplicates of files within a
> given directory and all its subdirectories. It seems like it's longer
> than it needs to be but I can't figure out how to shorten it. Perhaps
> there are some python features or libraries I'm not taking
clementine wrote:
> Thanx Nick...I forgot to mention im using python 2.2 and along with a
host
> of other things it doesnt seem to have the enumarate built in
function
> :(:(:(...is it possible to replace it by something else? I dont think
> simulating it will be feasible
Faced with Nick's on
[EMAIL PROTECTED] wrote:
> The use of frozenset can okay when sub-sequences are longer, but for
> this problem it's slow, and anyway there are situations of repeated
> data like this that have to be considered:
Not just for frozenset; this has to be considered whatever the
representation.
>
> fr
On 23 Feb 2005 22:06:54 -0800, "Kamilche" <[EMAIL PROTECTED]>
wrote:
>I'm trying to pack two characters into a single byte, and the shifting
>in Python has me confused.
>
>Essentially, it should be possible to use a 'packed string' format in
>Python, where as long as the characters you're sending
On Thu, 24 Feb 2005 11:53:32 -0500, Christopher De Vries
<[EMAIL PROTECTED]> wrote:
>On Wed, Feb 23, 2005 at 10:54:50PM -0500, Douglas Alan wrote:
>> Is there a canonical way of iterating over the lines of a file that
>> are null-separated rather than newline-separated?
>
>I'm not sure if there is
On 24 Feb 2005 10:57:58 -0800, [EMAIL PROTECTED] wrote:
>I was starting to write a dictionary to map operator strings to their
>equivalent special methods such as:
>{
> '+' : 'add',
> '&' : 'and_'
>}
>
>The idea is to build a simple interactive calculator.
>
>and was wondering if there is alread
On Thu, 24 Feb 2005 14:51:07 -0500, Christopher De Vries
<[EMAIL PROTECTED]> wrote:
>
>The other modification would be an option to ignore multiple nulls in a row,
>rather than returning empty strings, which could be done in a similar way.
>
Why not leave this to the caller? Efficiency?? Filterin
On Thu, 24 Feb 2005 16:51:22 -0500, Christopher De Vries
<[EMAIL PROTECTED]> wrote:
[snip]
>I think this is a definite improvement... especially putting the buffer size
>and line terminators as optional arguments, and handling empty files. I think,
>however that the if splitstr[-1]: ... else: ...
On Thu, 24 Feb 2005 17:48:47 -0800, Bryan <[EMAIL PROTECTED]> wrote:
>Xah Lee wrote:
>> another functional exercise with lists.
>>
>> Here's the perl documentation. I'll post a perl and the translated
>> python version in 48 hours.
>>
>> =pod
>>
>> parti(aList, equalFunc)
>>
>> given a list aL
Jeremy Sanders wrote:
> On Fri, 25 Feb 2005 17:14:24 +0100, Diez B. Roggisch wrote:
>
> > Maybe [c]StringIO can be of help. I don't know if it's iterator is
lazy. But
> > at least it has one, so you can try and see if it improves
performance :)
>
> Excellent! I somehow missed that module. StringIO
Patrick Useldinger wrote:
>
> fdups' homepage is at http://www.homepages.lu/pu/fdups.html, where
> you'll also find a link to download the tar.
>
"""fdups has no installation program. Just change into a temporary
directory, and type "tar xfj fdups.tar.bz". You should also chown the
files accordin
Lucas Raab wrote:
> Is it possible to assign a string a numerical value?? For example, in
> the string "test" can I assign a number to each letter as in "t" =
45,
> "e" = 89, "s" = 54, and so on and so forth??
>
> TIA
>>> for c in 'abcd':
...print c, ord(c)
...
a 97
b 98
c 99
d 100
If that
[EMAIL PROTECTED] wrote:
> why does the following error occur?
I don't know; I've never used the shelve module. Let's see what as two
utter n00bz we can find out. Let's check out where it clagged:
lib\anydbm.py, line 80, in open ...
Hmm, reading backwards a little, looks like it called whichdb.w
Patrick Useldinger wrote:
> John Machin wrote:
>
> > (1) It's actually .bz2, not .bz (2) Why annoy people with the
> > not-widely-known bzip2 format just to save a few % of a 12KB file??
(3)
> > Typing that on Windows command line doesn't produce a useful r
On Sat, 26 Feb 2005 23:53:10 +0100, Patrick Useldinger
<[EMAIL PROTECTED]> wrote:
> I've tested it intensively
"Famous Last Words" :-)
>Thanks for your feedback!
Here's some more:
(1) Manic s/w producing lots of files all the same size: the Borland
C[++] compiler produces a debug symbol file (
Egil Moeller wrote:
> Hi!
>
> I've written a C-module for Python, and it works as intended, but
> obviously does something wrong with its memmory management
(refference
> counting), as it causes Python to segfault now and then (randomly,
> whey :S)
>
> The module source code is available at
> http
[EMAIL PROTECTED] wrote:
> Kartic wrote:
> > > I'm having a problem where when trying to open a file in write
> mode,
> > I
> > > get an IOError stating no such file or directory. I'm calling an
> > > external program which takes an input file and produces an output
> > file
> > > repeatedly, sim
Douglas Alan wrote:
> I wrote:
>
> > Oops, I just realized that my previously definitive version did not
> > handle multi-character newlines. So here is a new definitive
> > version. Oog, now my brain hurts:
>
> I dunno what I was thinking. That version sucked! Here's a version
> that's actual
Douglas Alan wrote:
> "John Machin" <[EMAIL PROTECTED]> writes:
>
> >>lines = (partialLine + charsJustRead).split(newline)
>
> > The above line is prepending a short string to what will typically
be a
> > whole buffer full. There's gotta
[EMAIL PROTECTED] wrote:
> I just read in the 'What's New in Python 2.4' document that the None
> data type was converted to a constant:
> http://python.org/doc/2.4/whatsnew/node15.html
>
> """
> # None is now a constant; code that binds a new value to the name
> "None" is now a syntax error.
> ""
It's me wrote:
> If I have:
>
> a = (1,2,3)
>
> how do I ended up with:
>
> res=[(1), (2), (3), (4), (5)]
>
> without doing:
>
> res=[(a[0]), (a[1]), (a[2]), (4), (5)]
>
If by (x) you really mean a tuple with 1 element i.e. (x,) then you
need something like this:
>>> a = (1, 2, 3)
>>
I.V. Aprameya Rao wrote:
> Hi
>
> I have to implement a flat file dbms. The basic condition is that
> relations will be given in files and i will have to run certain
select
> project join queries on those relations.
>
> Can someone tell me as to which language will be faster, python or
C++??
Fast
Michael Hoffman wrote:
> Colin J. Williams wrote:
>
> > C:\XXX is required, C:XXX is not acceptable.
>
> C:XXX is acceptable, it just means something entirely different from
> C:\XXX. There is a current working directory on each drive. C:XXX is
> file XXX in the current directory on drive C:.
Fur
rbt wrote:
> How do I enable the hidden attribute when creating files on Windows
> computers? I'd *really* prefer to do from the standard Python
installer
> (no win32 extensions). Any tips?
>
> Thanks
Breaking your problem down a bit:
1. How is that done from the command line in Windows?
2. How t
[EMAIL PROTECTED] wrote:
> Sheesh... I didn't actually pull the type(None) comparison out of my
> code.
Sheesh yourself. Newsgroup readers can't do inspect.hasaclue('J. Random
Poster'); they rely on duck-typing or goose-typing.
> I was simply throwing together a possible situation. Had I
> thou
Fred wrote:
> Hi
> I am writing on an application, that is supposed to read a file into
a
> single string:
> My program though, when I run it, gives me an error, that the called
> file is non existent
> 'C:\ \Documents and Settings\ \Fred\ \My Documents\ \School\ \Bio'
> Is it normal that python a
Steve Juranich wrote:
> I'm in the process of writing a few extension types, and there's one
> that I'd sort of like to have getitem, setitem, getslice, setslice
> functionality for.
>
> I've been looking through the docs and how things are done in
> Objects/listobject.c, and it appears tha there
On Thu, 10 Mar 2005 20:06:29 +0200, Christos "TZOTZIOY" Georgiou
<[EMAIL PROTECTED]> wrote:
>On 10 Mar 2005 09:41:05 -0800, rumours say that "Albert Tu"
><[EMAIL PROTECTED]> might have written:
>
>>Dear there,
>>
>>We have an x-ray CT system. The acquisition computer acquires x-ray
>>projections a
[EMAIL PROTECTED] wrote:
> Skip Montanaro wrote:
>
> > I use sets a lot in my Python 2.3 code at work and have been using
> > this hideous import to make the future move to 2.4's set type
> > transparent:
>
> > try:
> > x = set
>
> (Surely just 'set' on its own is sufficient? This avoi
bruno modulix wrote:
> G. Völkl wrote:
> > Hello,
> >
> > I use a dictionary:
> >
> > phone = {'mike':10,'sue':8,'john':3}
> >
> > phone['mike'] --> 10
> >
> > I want to know who has number 3?
> > 3 --> 'john'
>
> Note that you can have many keys with the same value:
> phone = {'mike':10,'sue':
David Eppstein wrote:
> In article <[EMAIL PROTECTED]>,
> Patrick Useldinger <[EMAIL PROTECTED]> wrote:
>
> > > Well, but the spec didn't say efficiency was the primary
criterion, it
> > > said minimizing the number of comparisons was.
> >
> > That's exactly what my program does.
>
> If you're do
Chris wrote:
> hi,
> to convert excel files via csv to xml or whatever I frequently use
the
> csv module which is really nice for quick scripts. problem are of
course
> non ascii characters like german umlauts, EURO currency symbol etc.
The umlauted characters should not be a problem, they're all
Patrick Useldinger wrote:
> John Machin wrote:
>
> > Just look at the efficiency of processing N files of the same size
S,
> > where they differ after d bytes: [If they don't differ, d = S]
> >
> > PU: O(Nd) reading time, O(Nd) data comparison time [Actuall
Chris wrote:
> hi,
> thanks for all replies, I try if I can at least get the work done.
>
> I guess my problem mainly was the rather mindflexing (at least for
me)
> coding/decoding of strings...
>
> But I guess it would be really helpful to put the
UnicodeReader/Writer
> in the docs
UNFORTUNATELY
Patrick Useldinger wrote:
> John Machin wrote:
>
> > Maybe I was wrong: lawyers are noted for irritating precision. You
> > meant to say in your own defence: "If there are *any* number (n >=
2)
> > of identical hashes, you'd still need to *RE*-read and *com
jrlen balane *TOP-POSTED*:
> On 12 Mar 2005 07:39:31 -0800, Harlin Seritt <[EMAIL PROTECTED]>
wrote:
> > hah, this code is anything but simple...
> >
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> >
> @sir harlin
> so you are saying that there is nothing wrong in this simple progr
[EMAIL PROTECTED] wrote:
>
> What actually gets transmitted is "C\x01\x02\x10'\x83".
No, that's repr(What actually gets transmitted)
> That's 18 bytes. Is the command supposed to be the ASCII
> characters \x01 or a single byte whose value is 1?
For a start, according to the OP's code, the comma
Bengt Richter wrote:
> On 12 Mar 2005 17:35:50 -0800, "John Machin" <[EMAIL PROTECTED]>
wrote:
>
> >
> >[EMAIL PROTECTED] wrote:
> >>
> >> What actually gets transmitted is "C\x01\x02\x10'\x83".
> >
> >No, that's
Paul Rubin wrote:
> [EMAIL PROTECTED] writes:
> > I have list of lists of the following form
> >
> > L=[['A', 100], ['B', 300], ['A', 400], ['B', -100]]
> >
> > I want to aggregate these lists, i.e. to reduce L to
> > L=[['A', 500], ['B', 200]] #500 = 100+400, 200=300-100
>
> How about:
>
> v
jrlen balane wrote:
> the hardware is a school project that uses a microcontroller for
"light dimming"
> the message command "67" will tell the microcontroller (PIC16F877) to
> do a command (to control the intensity of a lamp)
> the message command "70" should tell the GUI that the microcontroller
Daniel Yoo wrote:
>
> Here you go:
>
> http://hkn.eecs.berkeley.edu/~dyoo/python/ahocorasick/
>
> This provides an 'ahocorasick' Python C extension module for doing
> matching on a set of keywords. I'll start writing out the package
> announcements tomorrow.
>
Looks good.
However:
tree.sea
Jan Rienyer Gadil wrote:
> @ sir Peter
> so you mean that it is correct (at least on the unpack() part)
No he doesn't mean that at all. All it means is that minor scuffles
have broken out among the spectators. Don't worry about them, batons &
water cannon will fix them; you concentrate on the foo
Sara Khalatbari wrote:
> Dear friends
> In a code, I'm opening a file to read. Like :
> lines = open(filename).readlines()
> & I'm never closing it.
> I'm not writing in that file, I just read it.
>
> Will it cause any problems if you open a file to read
> & never close it?
AFAIK, only if you
Ksenia Marasanova wrote:
> Hi,
>
> I have a little problem with encoding. Was hoping maybe anyone can
> help me to solve it.
>
> There is some amount of data in a database (PG) that must be inserted
> into Excel sheet and emailed. Nothing special, everything works.
> Except that non-ascii characte
jrlen balane wrote:
> why is it that here:
>
> 1)rx_data = ser.read(10)
> (rx_command, rx_msg_no, rx_no_databyte, temp1, temp2, pyra1,
> pyra2, voltage, current, rx_checksum) = unpack('10B', rx_data)
> print rx_command, rx_msg_no, rx_no_databyte, temp1, temp2, pyra1,
> pyra2, voltage, curr
Ksenia Marasanova wrote:
> > > There is some amount of data in a database (PG) that must be
inserted
> > > into Excel sheet and emailed. Nothing special, everything works.
> > > Except that non-ascii characters are not displayed properly.
> > > The data is stored as XML into a text field.
> >
> >
Ksenia Marasanova wrote:
> Sorry, I meant: I use field of the type 'text' in a Postgres table to
> store my data. The data is a XML string.
>
> > Instead of "print data", do "print repr(data)" and show us what you
> > get. What *you* see on the screen is not much use for diagnosis;
it's
> > the va
jrlen balane wrote:
> @sir John
> could you please show me how to do this exactly? it's in the "tip of
> my toungue" but i just can get it, please...
>
You've had far too much help already for a school project. Asking for
someone to write the code for you is "over the fence".
--
http://mail.pyt
Serge Orlov wrote:
> Looking at the following function in pyXLWriter
> def _asc2ucs(s):
> """Convert ascii string to unicode."""
> return "\x00".join(s) + "\x00"
>
> I can guess several things:
> a) pyXLWriter author is an ascii guy :)
Shrewd guess :-)
> b) unicode strings are not suppor
jrlen balane wrote:
> did some editing:
>
The error means that you received less than 19 bytes of data.
> rx_data = ser.read(19)
!rx_len = len(rx_data)
!print 'rx_len', rx_len
> byte[0:18] = unpack('19B', rx_data)
!# trash the above, do this
!byte = [ord(x) for x in rx_data]
!print 'received', b
201 - 300 of 3076 matches
Mail list logo