On 6/20/10, Steven D'Aprano wrote:
> On Mon, 21 Jun 2010 09:02:55 am Alex Hall wrote:
>> On 6/20/10, Neil Thorman wrote:
> [...]
>> inp = file("menu.txt", "r")
>> >
>> > *What is inp? What does it now contain?*
>>
>> It is now a reference to the location of the txt file.
>
> [pedantic]
> No,
On Mon, 21 Jun 2010 09:02:55 am Alex Hall wrote:
> On 6/20/10, Neil Thorman wrote:
[...]
> inp = file("menu.txt", "r")
> >
> > *What is inp? What does it now contain?*
>
> It is now a reference to the location of the txt file.
[pedantic]
No, it's actually an abstract data structure that wrap
On Mon, 21 Jun 2010 09:01:12 am Modulok wrote:
> List,
>
> What's the best format to send data across the wire between
> processes?
Consider json or yaml. json comes in the standard library, at least in
version 2.6; yaml does not. I don't know if they are secure, but it's
worth checking.
If you
"Neil Thorman" wrote
This is from Alan Gauld's Learning to Program: Handling Files.
http://www.freenetpages.co.uk/hp/alan.gauld/
One other thing. That page is now quite old and out of date. You
should switch to the current web site:
http://www.alan-g.me.uk/
inp = file("menu.txt", "r")
"Modulok" wrote
What's the best format to send data across the wire between
processes?
That depends on what you measure as 'best' - data volume, speed of
transmission, security, data complexity, flexibility, ease of decoding
etc etc.
a server via a TCP socket. Things like 'count = 10, nam
"Neil Thorman" wrote
inp = file("menu.txt", "r")
*What is inp? What does it now contain?*
print inp.readlines()
['spam & eggs\n', 'spam & chips\n', 'spam & spam']
but if I do it again I get:
print inp.readlines()
[]
I'm baffled, why is inp now empty?
OK, I've been asked thios before
On 20 June 2010 19:38, Neil Thorman wrote:
> I'm picking this up as a hobby really, not having done any programming
> since Acorn I'm pretty much starting form scratch (and even back in the
> BASIC day I never really got to grips with files).
> This is from Alan Gauld's Learning to Program: Handl
On 20 June 2010 23:52, Joe Veldhuis wrote:
> Hello all. I'm writing a program that needs to capture audio from a
> soundcard and run FFTs to determine peak frequency for further processing.
> The soundcard's native capture format is 16-bit little-endian signed integer
> samples (values 0-65535),
On 6/20/10, Neil Thorman wrote:
> I'm picking this up as a hobby really, not having done any programming since
> Acorn I'm pretty much starting form scratch (and even back in the BASIC day
> I never really got to grips with files).
> This is from Alan Gauld's Learning to Program: Handling Files.
>
List,
What's the best format to send data across the wire between processes?
I have some simple 'insensitive' data I need to send from a client, to
a server via a TCP socket. Things like 'count = 10, name="foo"' and so
forth. Basic values. I would use something like the 'pickle' module to
pack th
I'm picking this up as a hobby really, not having done any programming since
Acorn I'm pretty much starting form scratch (and even back in the BASIC day
I never really got to grips with files).
This is from Alan Gauld's Learning to Program: Handling Files.
http://www.freenetpages.co.uk/hp/alan.gaul
Hello all. I'm writing a program that needs to capture audio from a soundcard
and run FFTs to determine peak frequency for further processing. The
soundcard's native capture format is 16-bit little-endian signed integer
samples (values 0-65535), and of course the FFT function requires
floating-
OK, figured that was probably bad etiquette, but there doesn't seem to
be close to the same traffic. Mea culpa. I won't do it again. I think
most of my issues have to do with the gtk part, so I'll post there for
the most part. Thanks.
Timo wrote:
On 20-06-10 04:04, Lang Hurst wrote:
OK, I
"Payal" wrote
Hijacking the thread a bit. What about learning Jython and Python?
Do I
need to know Java to learn Jython?
No, but you will need to know the class heirarchy and reading
the documentation will be difficulty without at least a basic
knowledge of the Java syntax. Also you will pro
"Mark Lawrence" wrote
...I take issue with this "learn a language in five minutes" bit.
It took me five years to get to grips with plain old C.
C is non trivial but not hard (certainly compared to C++)
But 5 years is enough to do a lot more than "get to grips with"
a language, that's what I'd
T.R. D., 20.06.2010 16:04:
I decided to go with iterparse but trying the simple example in the python
interpreter led to an error (see below) and when I tried this with a much
larger xml sample, it seemed to print the full elements, not the specific
values of the element. For example, given what
Thanks all for your help.
I decided to go with iterparse but trying the simple example in the python
interpreter led to an error (see below) and when I tried this with a much
larger xml sample, it seemed to print the full elements, not the specific
values of the element. For example, given what I
"Steven D'Aprano" wrote
Yea I took an intro to comp sci class(like 2 years ago) and a
computer programming logic class(also like 2 years ago) both
using pseudocode
Good grief! How do they teach a class in computer programming using
pseudocode???
Yes, doing that 2 years ago seems odd.
OTOH W
On 6/20/2010 5:59 AM, Payal wrote:
On Sat, Jun 19, 2010 at 11:24:44AM +, ALAN GAULD wrote:
Actually that's a point. I favour learning two languages that are semantically
similar buut syntactically different. Thats why I chose JavaScript and VBScript
as my tutorial languages, because the
e
tutor-requ...@python.org wrote:
>Send Tutor mailing list submissions to
> tutor@python.org
>
>To subscribe or unsubscribe via the World Wide Web, visit
> http://mail.python.org/mailman/listinfo/tutor
>or, via email, send a message with subject or body 'help' to
> tutor-requ...
A
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On 20/06/2010 10:54, Payal wrote:
Hi,
Is it possible to solve the below, w/o making a re object?
a
'Mary Had a Little Lamb'
p=re.compile('l',re.I)
re.sub(p,'-',a)
'Mary Had a -itt-e -amb'
I cannot figure how to se re.I w/o involving p.
Thanks.
With warm regards,
-Payal
You can do this.
On Sun, Jun 20, 2010 at 12:03:47PM +0200, Evert Rol wrote:
> >>> re.sub('(?i)l', '-', a)
>
> See http://docs.python.org/library/re.html#regular-expression-syntax , search
> for iLmsux, which provide flags inside the regex.
Goodness that was fast. Thanks a lot Evert. For records,
>>> re.sub('l(
> Is it possible to solve the below, w/o making a re object?
>
a
> 'Mary Had a Little Lamb'
p=re.compile('l',re.I)
re.sub(p,'-',a)
> 'Mary Had a -itt-e -amb'
>
> I cannot figure how to se re.I w/o involving p.
Would this work?
>>> re.sub('(?i)l', '-', a)
See http://docs.python.o
On Sat, Jun 19, 2010 at 11:24:44AM +, ALAN GAULD wrote:
> Actually that's a point. I favour learning two languages that are
> semantically
> similar buut syntactically different. Thats why I chose JavaScript and
> VBScript
> as my tutorial languages, because the syntax of each is so differe
Hi,
Is it possible to solve the below, w/o making a re object?
>>> a
'Mary Had a Little Lamb'
>>> p=re.compile('l',re.I)
>>> re.sub(p,'-',a)
'Mary Had a -itt-e -amb'
I cannot figure how to se re.I w/o involving p.
Thanks.
With warm regards,
-Payal
--
On 20-06-10 04:04, Lang Hurst wrote:
OK, I just did the ugliest hack, from someone who only seems to do
ugly hacks. I set up a bunch of textview areas and defaulted them to
'not visible'. Then as I loop through my query results, I make them
visible one at a time. Well, it works perfect, but
Hi,
please don't top-post, it makes your replies hard to read in context.
Karim, 20.06.2010 10:24:
On 06/20/2010 10:14 AM, Stefan Behnel wrote:
Use ElementTree's iterparse:
from xml.etree.cElementTree import iterparse
>> [...]
>
I know you are promoting Etree and I am very interesting in it
Hello Stefan,
I know you are promoting Etree and I am very interesting in it.
Is there any chance to have it integrated in future standard Python version?
Regards
Karim
On 06/20/2010 10:14 AM, Stefan Behnel wrote:
T.R. D., 20.06.2010 08:03:
I'm trying to parse a list of xml strings and so fa
In fact you must initialize the handler before parsing the xml doc and
it should work.
Regards
Karim
France
On 06/20/2010 10:12 AM, Karim wrote:
Hello,
The following is an example which works for me to count opening tags
in a xml doc,
if it can help:
# -*- coding: iso-8859-1 -*-
import
T.R. D., 20.06.2010 08:03:
I'm trying to parse a list of xml strings and so far it looks like the
xml.parsers.expat is the way to go but I'm not quite sure how it works.
I'm trying to parse something similar to the following. I'd like to collect
all headings and bodies and associate them in a v
Hello,
The following is an example which works for me to count opening tags in
a xml doc,
if it can help:
# -*- coding: iso-8859-1 -*-
import sys
from xml.parsers.expat import ParserCreate
n = 0
def start_element(name, attrs): # callback declaration
global n
n += 1
parser =
Hi,
I'm trying to parse a list of xml strings and so far it looks like the
xml.parsers.expat is the way to go but I'm not quite sure how it works.
I'm trying to parse something similar to the following. I'd like to collect
all headings and bodies and associate them in a variable (dictionary for
33 matches
Mail list logo