Which part of the regexes do you not understand? Have you tried
figuring themselves out yourself first?
We don't typically give out answers here. This is a tutor list, not a
solve your problems for you list. We're here to teach you how to
fish, not cook for you. So show us where you're stuck and
Forwarding to tutor list, please use Reply All whjen replying to the group.
Alan Gauld
Author of the Learn To Program website
http://www.alan-g.me.uk/
- Original Message
> full error printout. I tried debugging it and I still don't know why
> guessed[index] = (letter) gives me an
On Tue, Dec 21, 2010 at 1:23 PM, Luke Paireepinart
wrote:
> You're not going to win any friends here Dave.
Wasn't trying to.
Steven is well known on this list.
And that means something to you only.
He is sometimes abrasive but it's rarely if ever malicious.
Anytime he's ever been rude to me
On 21 December 2010 17:57, Alan Gauld wrote:
>
> "Stefan Behnel" wrote
>
> But I don't understand how uncompressing a file before parsing it can
>>> be faster than parsing the original uncompressed file?
>>>
>>
>> I didn't say "uncompressing a file *before* parsing it". I meant
>> uncompressing
On 21 December 2010 14:11, Alan Gauld wrote:
> But I don't understand how uncompressing a file before parsing it can
> be faster than parsing the original uncompressed file?
>
Because of IO overhead/benefits. It's not so much that the parsing aspect
of it is faster of course (it is what it is),
>
> OT(off_topic): I moved to the bay area recently & am passionate about
> technology in general & linux, python, c, embedded, mobile, wireless
> stuff,.
> I was wondering if any of you guys, are part of some bay area python( or
> other tech) meetup ( as in do you guys meetup, in person) for l
You're not going to win any friends here Dave. Steven is well known on this
list. He is sometimes abrasive but it's rarely if ever malicious. Anytime he's
ever been rude to me it was deserved. Like how I top post from my phone. Or
giving bad advice to newbies.
People are getting irritated becau
Read() does return a string. I guess the better question would be... Are you
using read? 'cause in the example you sent you used readlines() which returns a
list of lines.
-
Sent from a mobile device with a bad e-mail client.
-
On Dec 21,
"Ben Ganzfried" wrote
1) Doesn't the read() file object method return the specified
characters from the file as a string?
Yes
2) If #1 is correct, then why is my variable "source" being viewed
as
a list as opposed to a string?
You are not using read(), you are using readlines()
which ret
"Stefan Behnel" wrote
But I don't understand how uncompressing a file before parsing it
can
be faster than parsing the original uncompressed file?
I didn't say "uncompressing a file *before* parsing it". I meant
uncompressing the data *while* parsing it.
Ah, ok that can work, although it
Hey,
I keep getting the error above and unfortunately browsing through
google and finding similar responses has not been fruitful for me. My
code is below and I have marked off the location of the problem in my
code. I'm wondering the following:
1) Doesn't the read() file object method return t
David Hutto, 21.12.2010 16:11:
On Tue, Dec 21, 2010 at 10:03 AM, Stefan Behnel wrote:
I meant
uncompressing the data *while* parsing it. Just like you have to decode it
for parsing, it's just an additional step to decompress it before decoding.
Depending on the performance relation between I/O s
On Tue, Dec 21, 2010 at 10:03 AM, Stefan Behnel wrote:
> Alan Gauld, 21.12.2010 15:11:
>>
>> "Stefan Behnel" wrote
And I thought a 1G file was extreme... Do these people stop to think
that
with XML as much as 80% of their "data" is just description (ie the
tags).
>>>
>>> A
I have been reading regex in order to work around an assignment.
Could anyone explain to me in plain english what the following regex expression
translate to.
(r'PSC(?P\d{6})(DC|VR)(\d{2})(RC|GA)(\d{3})(!?([A-Z\d]{1,})@?(.*))?',
re.I)
(r'PSC(?P\d{6})VR(?P\d{2})RC(?P\d{3})(?P[ABCDEFGHJKMNPQRS
Alan Gauld, 21.12.2010 15:11:
"Stefan Behnel" wrote
And I thought a 1G file was extreme... Do these people stop to think that
with XML as much as 80% of their "data" is just description (ie the tags).
As I already said, it compresses well. In run-length compressed XML
files, the tags can easil
And a lesson of what you really are to anyone listening.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
you got nothing of real value.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Me and you, apparently know exactly what i'm talking about...
http://code.activestate.com/lists/python-tutor/79293/
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On Tue, Dec 21, 2010 at 9:40 AM, David Hutto wrote:
> On Tue, Dec 21, 2010 at 9:36 AM, Steven D'Aprano wrote:
>> David Hutto wrote:
>>>
>>> Establish that with fact that initiatially I didn't have a reason to
>>> be hostile, and that your comment of my kubit kaba here, and your
>>> comment on com
On Tue, Dec 21, 2010 at 9:36 AM, Steven D'Aprano wrote:
> David Hutto wrote:
>>
>> Establish that with fact that initiatially I didn't have a reason to
>> be hostile, and that your comment of my kubit kaba here, and your
>> comment on comp.python.lang about your pystats, aftger our
>> conversation
And furthermore, I'm not the first, nor the last to get angry and
frustrated on the internet. I'm not the first to get drunk, and type.
And I dare any employer to deny me the right to MY personal time.
___
Tutor maillist - Tutor@python.org
To unsubscrib
David Hutto wrote:
Establish that with fact that initiatially I didn't have a reason to
be hostile, and that your comment of my kubit kaba here, and your
comment on comp.python.lang about your pystats, aftger our
conversation, and your reference to it not being "set in stone",
wasn't a reference
On Tue, Dec 21, 2010 at 9:32 AM, David Hutto wrote:
> Take a look at the flame wars individuals see, comments by programmers
> who are sarcastic, and think of the response you might have had to the
> initial questions you had , and maybe even a few paranoid delusions
> you got hacked.
>
> It's not
Take a look at the flame wars individuals see, comments by programmers
who are sarcastic, and think of the response you might have had to the
initial questions you had , and maybe even a few paranoid delusions
you got hacked.
It's not a rewarding experience not being a college educated
individual
Establish that with fact that initiatially I didn't have a reason to
be hostile, and that your comment of my kubit kaba here, and your
comment on comp.python.lang about your pystats, aftger our
conversation, and your reference to it not being "set in stone",
wasn't a reference tyo our statrs argume
"Stefan Behnel" wrote
And I thought a 1G file was extreme... Do these people stop to
think that
with XML as much as 80% of their "data" is just description (ie the
tags).
As I already said, it compresses well. In run-length compressed XML
files, the tags can easily take up a negligible amo
"Steven D'Aprano" wrote
It's natural competitors are TLV (Tag,Lenth,Value) and
CSV(Comma Seperated Value) files but neither is as rich
I would have thought that both JSON and YAML are competitors to XML,
Totally agree but I excluded those on the basis that they weren't
around when XML was
Stefan Behnel wrote:
David Hutto, 21.12.2010 10:29:
File = string
going through string code
finding pieces of the string and marking the territory.
I don't see 'real' optimization other than rolling your own.
Reads like a Haiku. Doesn't quite fit the verse, though.
From your behaviour, I
Alan Gauld wrote:
XML is a self-describing data format. It is usually used for files
but can be used in data streams or in-memory strings.
It's natural competitors are TLV (Tag,Lenth,Value) and
CSV(Comma Seperated Value) files but neither is as rich
in structure. Alternative options include AS
David Hutto, 21.12.2010 13:09:
On Tue, Dec 21, 2010 at 6:59 AM, Stefan Behnel wrote:
David Hutto, 21.12.2010 12:45:
If file a.xml has simple tagged xml like, and file b.config has
tags that represent the a.xml(i.e.=) as greater tags,
does this pattern optimize the process by limiting the s
On Tue, Dec 21, 2010 at 6:59 AM, Stefan Behnel wrote:
> David Hutto, 21.12.2010 12:45:
>>>
>>> If file a.xml has simple tagged xml like, and file b.config has
>>> tags that represent the a.xml(i.e. =) as greater tags,
>>> does this pattern optimize the process by limiting the size of the
>>> tags
David Hutto, 21.12.2010 12:45:
If file a.xml has simple tagged xml like, and file b.config has
tags that represent the a.xml(i.e. =) as greater tags,
does this pattern optimize the process by limiting the size of the
tags to be parsed in the xml, then converting those simpler tags that
are found
On Tue, Dec 21, 2010 at 6:41 AM, David Hutto wrote:
> On Tue, Dec 21, 2010 at 6:19 AM, Stefan Behnel wrote:
>> David Hutto, 21.12.2010 12:02:
>>>
>>> On Tue, Dec 21, 2010 at 5:45 AM, Alan Gauld wrote:
8 bytes to describe an int which could be represented in
a single byte in binary
On Tue, Dec 21, 2010 at 6:19 AM, Stefan Behnel wrote:
> David Hutto, 21.12.2010 12:02:
>>
>> On Tue, Dec 21, 2010 at 5:45 AM, Alan Gauld wrote:
>>>
>>> 8 bytes to describe an int which could be represented in
>>> a single byte in binary (or even in CSV).
>
> Well, "CSV" indicates that there's at l
David Hutto, 21.12.2010 12:02:
On Tue, Dec 21, 2010 at 5:45 AM, Alan Gauld wrote:
8 bytes to describe an int which could be represented in
a single byte in binary (or even in CSV).
Well, "CSV" indicates that there's at least one separator character
involved, so make that an asymptotic 2 bytes
On Tue, Dec 21, 2010 at 5:49 AM, Stefan Behnel wrote:
> David Hutto, 21.12.2010 11:29:
>>
>> On Tue, Dec 21, 2010 at 5:19 AM, Stefan Behnel wrote:
>>>
>>> Alan Gauld, 21.12.2010 10:58:
>
> 22 Jan 2009 ... Stripping Illegal Characters from XML in Python>>
... I'd be asking Python
On Tue, Dec 21, 2010 at 5:45 AM, Alan Gauld wrote:
>
> "David Hutto" wrote
>
>> That';s what I saying above that xml seems to be the hog in terms of
>> it's user defined tags. Is that somewhat a confirmation of my hunch,
>> that it's the length of the users predefined tags that add to the
>> abov
On Tuesday 21.12.2010 10:12:55 David Hutto wrote:
> Then what other file medium would you suggest as the tagging means.
One of those formats, that are specially designed for large amounts of data,
is HDF5. It is intended for numerical data, but you can store text as well.
There are multiple Pyth
Yasin Yaqoobi wrote:
> # This is the line that gives me the error don't know why?
> guessed[index] = " " + (letter); ,TypeError: 'str' object does not
> support item assignment
I don't get this far because I run into
Traceback (most recent call last):
File "hangman.py", line 69, in
line =
David Hutto, 21.12.2010 11:29:
On Tue, Dec 21, 2010 at 5:19 AM, Stefan Behnel wrote:
Alan Gauld, 21.12.2010 10:58:
22 Jan 2009 ... Stripping Illegal Characters from XML in Python>>
... I'd be asking Python to process 6.4 gigabytes of CSV into
6.5 gigabytes of XML 1. . In fact, what happen
On Tue, Dec 21, 2010 at 5:35 AM, Alan Gauld wrote:
>
> "David Hutto" wrote
>
>> Somewhat of the fact that python uses C encourages me of that, but I
>> have still been looking into c++ to optimize, because I've used it
>> before, and the more languages I learn the more they feel 'similar',
>> but
"David Hutto" wrote
That';s what I saying above that xml seems to be the hog in terms of
it's user defined tags. Is that somewhat a confirmation of my hunch,
that it's the length of the users predefined tags that add to the
above mess, and that maybe a lessened tag system in accordance with
xm
On Tue, Dec 21, 2010 at 5:25 AM, Stefan Behnel wrote:
> David Hutto, 21.12.2010 11:16:
>>
>> I understand it's .pyc so it's a compiled file and ready for usage
>> as 'anyother'(I might be wrong on this, but sure it's the same as
>> converting the original py file straight back to c).
>
> ".pyc" fi
"David Hutto" wrote
Somewhat of the fact that python uses C encourages me of that, but I
have still been looking into c++ to optimize, because I've used it
before, and the more languages I learn the more they feel 'similar',
but the same, if you can understand that!
Absolutely! That's why I
"David Hutto" wrote
(*)ASN.1, IDL etc all rely on a shared definition, and
often shared code library, at both sender and receiver.
This I might have to work on, but I rely on experience to
quasi-trust
experience.
These are all data transport formats agreed and standardised
long before XM
David Hutto, 21.12.2010 11:16:
I understand it's .pyc so it's a compiled file and ready for usage
as 'anyother'(I might be wrong on this, but sure it's the same as
converting the original py file straight back to c).
".pyc" files have nothing to do with C. They are just compiled byte code,
and
On Tue, Dec 21, 2010 at 5:19 AM, Stefan Behnel wrote:
> Alan Gauld, 21.12.2010 10:58:
>>
>> "David Hutto" wrote
>>>
>>>
>>> http://www.google.com/search?client=ubuntu&channel=fs&q=parsing+gigabyte+xml+python&ie=utf-8&oe=utf-8
>>
>> Eeek! One of the listings says:
>>
>>> 22 Jan 2009 ... Stripping I
Alan Gauld, 21.12.2010 10:46:
You don't have to use it for data transfer - eg MS's use
as a document storage format in Office - but frankly if
you use XML to store large volumes of data you are mad,
a database is a much more sensible option being far more
space efficient and faster to work with.
Give me a little time to review this when it's not 5:30 in the morning
and I've been up since 9 am yesterday, and 'relearning' c++:)
But it still seems that you have have coding + filetype +
charactersinfileinformat., one long string that has to be parsed by
the C functions.
__
"Yasin Yaqoobi" wrote
I'm confused. The error message you describe doesn't
appear to match any line in your code.
Please provide the full error printout not just a single line.
Meanwhile some comments...
global line
global index;
global is not doing anything here, it is only effective insi
Alan Gauld, 21.12.2010 10:58:
"David Hutto" wrote
http://www.google.com/search?client=ubuntu&channel=fs&q=parsing+gigabyte+xml+python&ie=utf-8&oe=utf-8
Eeek! One of the listings says:
22 Jan 2009 ... Stripping Illegal Characters from XML in Python >>
... I'd be asking Python to process 6.4
On Tue, Dec 21, 2010 at 5:00 AM, Stefan Behnel wrote:
> David Hutto, 21.12.2010 10:46:
>>
>> On Tue, Dec 21, 2010 at 4:34 AM, Stefan Behnel wrote:
>>>
>>> David Hutto, 21.12.2010 10:19:
If I want to write a programming language, It might not be the best
idea to have a labguage neede
"jtl999" wrote
when I try to multiply with a decimal number in python with the
input
this is what i get
Enter first number: 1.2
Traceback (most recent call last):
File "Timesed.py", line 18, in
numberx1 = (int)(raw_input('Enter first number: '))
ValueError: invalid literal for int() wi
On Tue, Dec 21, 2010 at 4:58 AM, Alan Gauld wrote:
>
> "David Hutto" wrote
>
>>> I sympathize with you. I wonder who thought that building a 1GB XML file
>>> was a good thing.
>
>> that was just the first listing:
>>
>>
>> http://www.google.com/search?client=ubuntu&channel=fs&q=parsing+gigabyte+x
"David Hutto" wrote
XML stands for eXtensible Markup Language.
XML is designed to transport and store data.
Then what other file medium would you suggest as the tagging means.
See my other post but there are many alternatives that are orders
of magnitude more efficient. XML is one of the mo
On Tue, Dec 21, 2010 at 4:49 AM, Alan Gauld wrote:
>
> "David Hutto" wrote
>
>> > Note that it's not unlikely that this is actually *slower* than > using
>> > a real
>> > XML parser:
>>
>> Or a 'real' language like C or C++ maybe to increase, or in Python's
>> case, bypass, the interpreter?
>
> M
On Tue, Dec 21, 2010 at 4:46 AM, Alan Gauld wrote:
> "David Hutto" wrote
>
>>> And from what I recall XML is intended for data transfer in respect to
>>> HTML(from a recent brushup, nothing more),
>>
>> Apologies that is browser based transfer,
>
> I'm not sure what that last bit means.
> XML is
David Hutto, 21.12.2010 10:46:
On Tue, Dec 21, 2010 at 4:34 AM, Stefan Behnel wrote:
David Hutto, 21.12.2010 10:19:
If I want to write a programming language, It might not be the best
idea to have a labguage needed for speed based on Python, I should
maybe use wha it's based on, or refine my ow
"David Hutto" wrote
I sympathize with you. I wonder who thought that building a 1GB XML
file
was a good thing.
that was just the first listing:
http://www.google.com/search?client=ubuntu&channel=fs&q=parsing+gigabyte+xml+python&ie=utf-8&oe=utf-8
Eeek! One of the listings says:
22 Jan
On Tue, Dec 21, 2010 at 4:43 AM, Stefan Behnel wrote:
> David Hutto, 21.12.2010 10:29:
>>
>> File = string
A file is a string of character encoded in it's format
>>
>> going through string code
Code that goes through the file format and the encoding
>>
>> finding pieces of the string and marki
"David Hutto" wrote
> Note that it's not unlikely that this is actually *slower* than
> using a real
> XML parser:
Or a 'real' language like C or C++ maybe to increase, or in Python's
case, bypass, the interpreter?
Most of the Python xml parsers are written in C - many use the
industry sta
"David Hutto" wrote
And from what I recall XML is intended for data transfer in respect
to
HTML(from a recent brushup, nothing more),
Apologies that is browser based transfer,
I'm not sure what that last bit means.
XML is a self-describing data format. It is usually used for files
but can
On Tue, Dec 21, 2010 at 4:34 AM, Stefan Behnel wrote:
> David Hutto, 21.12.2010 10:19:
>>
>> On Tue, Dec 21, 2010 at 4:17 AM, David Hutto wrote:
>>>
>>> On Tue, Dec 21, 2010 at 4:10 AM, Stefan Behnel wrote:
>>
>> Note that it's not unlikely that this is actually *slower* than using
>>
David Hutto, 21.12.2010 10:29:
File = string
going through string code
finding pieces of the string and marking the territory.
I don't see 'real' optimization other than rolling your own.
Reads like a Haiku. Doesn't quite fit the verse, though.
From your behaviour, I get the impression tha
On Tue, Dec 21, 2010 at 4:28 AM, Stefan Behnel wrote:
> Hi,
>
> I wonder why you reply to my e-mail without replying to what I wrote in it.
>
>
> David Hutto, 21.12.2010 10:12:
>>
>> .
>>
>> I sympathize with you. I wonder who thought that building a 1GB XML
>> file
>> was a good t
David Hutto, 21.12.2010 10:19:
On Tue, Dec 21, 2010 at 4:17 AM, David Hutto wrote:
On Tue, Dec 21, 2010 at 4:10 AM, Stefan Behnel wrote:
Note that it's not unlikely that this is actually *slower* than using a
real XML parser:
Or a 'real' language like C or C++ maybe to increase, or in Python'
File = string
going through string code
finding pieces of the string and marking the territory.
I don't see 'real' optimization other than rolling your own.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://
Hi,
I wonder why you reply to my e-mail without replying to what I wrote in it.
David Hutto, 21.12.2010 10:12:
.
I sympathize with you. I wonder who thought that building a 1GB XML file
was a good thing.
This was written by Steven D'Aprano.
If it is:
XML stands for eXtensible Markup Lan
global line
global index;
guessed = ["-"];
count = 0;
wrong = 0;
def guess(letter):
global guessed
if (letter in line):
index = line.index(letter);
print guessed;
# This is the line that gives me the error don't know why?
guessed[index] = " " + (letter); ,TypeError: 'st
On Tue, Dec 21, 2010 at 4:17 AM, David Hutto wrote:
> On Tue, Dec 21, 2010 at 4:10 AM, Stefan Behnel wrote:
>> David Hutto, 21.12.2010 09:55:
>>>
>>> On Tue, Dec 21, 2010 at 3:52 AM, Stefan Behnel wrote:
Chris Fuller, 21.12.2010 03:27:
>
> This isn't XML, it's an abomination of
On Tue, Dec 21, 2010 at 4:10 AM, Stefan Behnel wrote:
> David Hutto, 21.12.2010 09:55:
>>
>> On Tue, Dec 21, 2010 at 3:52 AM, Stefan Behnel wrote:
>>>
>>> Chris Fuller, 21.12.2010 03:27:
This isn't XML, it's an abomination of XML. Best to not treat it as
XML.
Good thing you're
.
I sympathize with you. I wonder who thought that building a 1GB XML file
was a good thing.
If it is:
XML stands for eXtensible Markup Language.
XML is designed to transport and store data.
Then what other file medium would you suggest as the tagging means.
You have a file wit
David Hutto, 21.12.2010 09:55:
On Tue, Dec 21, 2010 at 3:52 AM, Stefan Behnel wrote:
Chris Fuller, 21.12.2010 03:27:
This isn't XML, it's an abomination of XML. Best to not treat it as XML.
Good thing you're only after one class of tags. Here's what I'd do. I'll
give a general solution, but
On Tue, Dec 21, 2010 at 3:59 AM, David Hutto wrote:
> And from what I recall XML is intended for data transfer in respect to
> HTML(from a recent brushup, nothing more),
Apologies that is browser based transfer, (not sure what more,
although I think it means any data tranfer)
so not having used
David Hutto, 21.12.2010 09:49:
Steven D'Aprano, 20.12.2010 22:19:
ashish makani wrote:
Goal : I am trying to parse a ginormous ( ~ 1gb) xml file.
I sympathize with you. I wonder who thought that building a 1GB XML file
was a good thing.
http://gnosis.cx/publish/programming/xml_matters_29.
And from what I recall XML is intended for data transfer in respect to
HTML(from a recent brushup, nothing more), so not having used it, it
sure has been displayed as a data transfer mechanism, I remember this
from using Joomla's framework, and the xml files for menus I think.
_
On Tue, Dec 21, 2010 at 3:55 AM, David Hutto wrote:
> On Tue, Dec 21, 2010 at 3:52 AM, Stefan Behnel wrote:
>> Chris Fuller, 21.12.2010 03:27:
>>>
>>> This isn't XML, it's an abomination of XML. Best to not treat it as XML.
>>> Good thing you're only after one class of tags. Here's what I'd do.
On Tue, Dec 21, 2010 at 3:52 AM, Stefan Behnel wrote:
> Chris Fuller, 21.12.2010 03:27:
>>
>> This isn't XML, it's an abomination of XML. Best to not treat it as XML.
>> Good thing you're only after one class of tags. Here's what I'd do. I'll
>> give a general solution, but there are two parame
But then again, maybe it's too much of an optimization for someone not
optimizing for others or a specific application for the hardware, or
it's not part of the standard python library, and therefore,
expendable.
___
Tutor maillist - Tutor@python.org
To
Chris Fuller, 21.12.2010 03:27:
This isn't XML, it's an abomination of XML. Best to not treat it as XML.
Good thing you're only after one class of tags. Here's what I'd do. I'll
give a general solution, but there are two parameters / four cases that could
make the code simpler, I'll just point
On Tue, Dec 21, 2010 at 3:44 AM, Stefan Behnel wrote:
> [note that this has also been posted to comp.lang.python and discussed
> separately over there]
>
> Steven D'Aprano, 20.12.2010 22:19:
>>
>> ashish makani wrote:
>>
>>> Goal : I am trying to parse a ginormous ( ~ 1gb) xml file.
>>
>> I sympat
[note that this has also been posted to comp.lang.python and discussed
separately over there]
Steven D'Aprano, 20.12.2010 22:19:
ashish makani wrote:
Goal : I am trying to parse a ginormous ( ~ 1gb) xml file.
I sympathize with you. I wonder who thought that building a 1GB XML file
was a goo
82 matches
Mail list logo