Re: XML/XHTML/HTML differences, bugs... and howto

2013-01-23 Thread Andrew Robinson
On 01/24/2013 06:42 AM, Stefan Behnel wrote: Andrew Robinson, 23.01.2013 16:22: Good day :), Nope, you should read the manual on this. Here's a tutorial: http://lxml.de/tutorial.html#elements-contain-text I see, so it should be under the "tail" attribute, not the "text" attribute. That's why

Re: XML/XHTML/HTML differences, bugs... and howto

2013-01-23 Thread Stefan Behnel
Andrew Robinson, 23.01.2013 16:22: > Good day :), > > I've been exploring XML parsers in python; particularly: > xml.etree.cElementTree; and I'm trying to figure out how to do it > incrementally, for very large XML files -- although I don't think the > problems are restricted to incremental parsin

Re: Decrease for loop by one

2013-01-23 Thread Milter Skyler
On Wednesday, January 23, 2013 9:59:13 PM UTC-7, Chris Angelico wrote: > On Thu, Jan 24, 2013 at 3:39 PM, Milter Skyler <> wrote: > > > I made an array to check if the random integer already exists and then I > > send it to the else statement at which point I want to decrease x by 1 so > > that

Re: Retrieving the full command line

2013-01-23 Thread Chris Angelico
On Thu, Jan 24, 2013 at 3:49 PM, Steven D'Aprano wrote: > Note however that there is an ambiguity between calling "python -mspam" > and calling a script literally named "-mspam". But that same ambiguity > exists in the shell, so I don't consider it a problem. You cannot call a > script named -mspa

Re: Arent these snippets equivalent?

2013-01-23 Thread Coolgg
On Wednesday, January 23, 2013 6:38:54 PM UTC-8, Terry Reedy wrote: > On 1/23/2013 6:29 PM, Tim Chase wrote: > > > On 01/23/13 16:47, Roy Smith wrote: > > >> while getchar() as c: > > >> putchar(c) > > >> > > >> That would give people (including me) the use case they're after most of > >

Re: Decrease for loop by one

2013-01-23 Thread Chris Angelico
On Thu, Jan 24, 2013 at 3:39 PM, Milter Skyler wrote: > I made an array to check if the random integer already exists and then I send > it to the else statement at which point I want to decrease x by 1 so that it > doesn't count as one of the loops. In other languages this works... A Python 'fo

Re: Retrieving the full command line

2013-01-23 Thread Steven D'Aprano
On Wed, 23 Jan 2013 10:01:24 +, Oscar Benjamin wrote: > On 23 January 2013 03:58, Steven D'Aprano > wrote: >> On Wed, 23 Jan 2013 00:53:21 +, Oscar Benjamin wrote: >> >>> On 22 January 2013 23:46, Steven D'Aprano >>> wrote: [SNIP] >>> The purpose of the -m option is that you can run

Decrease for loop by one

2013-01-23 Thread Milter Skyler
I'm using this code with Sikuli so thats why I have click() for x in range(0,10): decimal_value = random.randint(1,12) if myList.count(decimal_value) < 1: egg = 'A%d.png' % (decimal_value) egg = wait(egg) click(egg.getCenter().offset(random.ra

Re: urllib2 FTP Weirdness

2013-01-23 Thread Steven D'Aprano
On Thu, 24 Jan 2013 01:45:31 +0100, Hans Mulder wrote: > On 24/01/13 00:58:04, Chris Angelico wrote: >> On Thu, Jan 24, 2013 at 7:07 AM, Nick Cash >> wrote: >>> Python 2.7.3 on linux >>> >>> This has me fairly stumped. It looks like >>> urllib2.urlopen("ftp://some.ftp.site/path";).read()

Re: Failed to import a "pyd: File When python intepreter embed in C++ project

2013-01-23 Thread Junze Liu
On Thursday, January 24, 2013 12:28:58 AM UTC+8, Leonard, Arah wrote: > > I create a pyd File named "testPyd" with boostPython,and then I import the > > testPyd module into "test.py", it works perfect! > > > But when I embeded the python interpreter into my C++ project and run the > > "test.py",

Re: Arent these snippets equivalent?

2013-01-23 Thread Terry Reedy
On 1/23/2013 6:29 PM, Tim Chase wrote: On 01/23/13 16:47, Roy Smith wrote: while getchar() as c: putchar(c) That would give people (including me) the use case they're after most of the time (call a function, assign the return value, and test it). It's way less klunky than: while True:

Re: Any algorithm to preserve whitespaces?

2013-01-23 Thread Dave Angel
On 01/23/2013 07:49 PM, Steven D'Aprano wrote: Santosh Kumar wrote: Yes, Peter got it right. Peter? Which Peter? What's "it" that he got right? You have deleted all context from your post, so I have no idea what you are talking about. Right. And whatever program you are using to post is

Re: Search log for string and display hourly/daily report

2013-01-23 Thread spek06
On Wednesday, January 23, 2013 4:25:59 PM UTC-5, John Gordon wrote: > In <4f952e77-258d-47ae-9d76-a86daa8ac...@googlegroups.com> spek06 writes: > > > > > I need to search a log file for a specific string (Successfully Sent) and > > > report the number of instances in the last hour (from when ex

Re: Uniquely identifying each & every html template

2013-01-23 Thread Dave Angel
On 01/23/2013 07:39 PM, Chris Angelico wrote: On Thu, Jan 24, 2013 at 11:09 AM, Dave Angel wrote: I certainly can't disagree that it's easy to produce a very long hash that isn't at all secure. But I would disagree that longer hashes *automatically* reduce chances of collision. Sure. But by

Re: Any algorithm to preserve whitespaces?

2013-01-23 Thread Steven D'Aprano
Santosh Kumar wrote: > Yes, Peter got it right. Peter? Which Peter? What's "it" that he got right? You have deleted all context from your post, so I have no idea what you are talking about. And whatever program you are using to post is stripping out threading information, so I can't tell what po

Re: urllib2 FTP Weirdness

2013-01-23 Thread Hans Mulder
On 24/01/13 00:58:04, Chris Angelico wrote: > On Thu, Jan 24, 2013 at 7:07 AM, Nick Cash > wrote: >> Python 2.7.3 on linux >> >> This has me fairly stumped. It looks like >> urllib2.urlopen("ftp://some.ftp.site/path";).read() >> will either immediately return '' or hang indefinitely. But >

Re: urllib2 FTP Weirdness

2013-01-23 Thread Steven D'Aprano
Nick Cash wrote: > Python 2.7.3 on linux > > This has me fairly stumped. It looks like > urllib2.urlopen("ftp://some.ftp.site/path";).read() > will either immediately return '' or hang indefinitely. But > response = urllib2.urlopen("ftp://some.ftp.site/path";) > response.read() > work

Re: Uniquely identifying each & every html template

2013-01-23 Thread Chris Angelico
On Thu, Jan 24, 2013 at 11:09 AM, Dave Angel wrote: > I certainly can't disagree that it's easy to produce a very long hash that > isn't at all secure. But I would disagree that longer hashes > *automatically* reduce chances of collision. Sure. But by and large, longer hashes give you a better c

Re: Uniquely identifying each & every html template

2013-01-23 Thread Dave Angel
On 01/23/2013 06:25 PM, Chris Angelico wrote: On Wed, Jan 23, 2013 at 11:38 PM, Dave Angel wrote: You think it's an accident that md5 size is roughly equivalent to 39 decimal digits? Or that the ones that haven't been proven insecure are much larger than that? The sha512 hash is roughly equiv

Re: urllib2 FTP Weirdness

2013-01-23 Thread Chris Angelico
On Thu, Jan 24, 2013 at 7:07 AM, Nick Cash wrote: > Python 2.7.3 on linux > > This has me fairly stumped. It looks like > urllib2.urlopen("ftp://some.ftp.site/path";).read() > will either immediately return '' or hang indefinitely. But > response = urllib2.urlopen("ftp://some.ftp.s

Re: Arent these snippets equivalent?

2013-01-23 Thread Tim Chase
On 01/23/13 16:47, Roy Smith wrote: while getchar() as c: putchar(c) That would give people (including me) the use case they're after most of the time (call a function, assign the return value, and test it). It's way less klunky than: while True: c = getchar() if c: # I presume yo

Re: Uniquely identifying each & every html template

2013-01-23 Thread Chris Angelico
On Wed, Jan 23, 2013 at 11:38 PM, Dave Angel wrote: > You think it's an accident that md5 size is roughly equivalent to 39 decimal > digits? Or that the ones that haven't been proven insecure are much larger > than that? The sha512 hash is roughly equivalent to 154 decimal digits. Proving a has

Re: Arent these snippets equivalent?

2013-01-23 Thread Chris Angelico
On Thu, Jan 24, 2013 at 9:47 AM, Roy Smith wrote: > while getchar() as c: >putchar(c) > > That would give people (including me) the use case they're after most of > the time (call a function, assign the return value, and test it). It's > way less klunky than: > > while True: >c = getchar(

XML/XHTML/HTML differences, bugs... and howto

2013-01-23 Thread Andrew Robinson
Good day :), I've been exploring XML parsers in python; particularly: xml.etree.cElementTree; and I'm trying to figure out how to do it incrementally, for very large XML files -- although I don't think the problems are restricted to incremental parsing. First problem: I've come across an iss

Re: Arent these snippets equivalent?

2013-01-23 Thread Evan Driscoll
On 01/23/2013 03:56 PM, Coolgg wrote: > Is this: > > while True: > data = fp.read(4096) > if not data: > break > ... > > not equivalent to this: > > data = fp.read (4096) > while data: > ...{handle the chunk here} > data = fp.read (4096) > > Heres the article that sp

Re: Understanding while...else...

2013-01-23 Thread Terry Reedy
On 1/22/2013 7:39 PM, Oscar Benjamin wrote: On 22 January 2013 23:41, Terry Reedy wrote: On 1/22/2013 3:09 PM, Ethan Furman wrote: On 01/22/2013 09:44 AM, Terry Reedy wrote: [SNIP] The else clause is executed if and when the condition is false. Now use a real Python while statement to do

Re: Arent these snippets equivalent?

2013-01-23 Thread Roy Smith
In article , Chris Angelico wrote: > Personally, I'd much rather have a 'while' condition that does > assignment, but that's something Python's unlikely ever to do. > There've been various proposals to make that possible, but ultimately > the only way to make that work is for assignment to be an

Re: Understanding while...else...

2013-01-23 Thread Terry Reedy
On 1/22/2013 1:15 PM, Jean-Michel Pichavant wrote: - Original Message - Several people have trouble understanding Python's while-else and for-else constructs. It is actually quite simple agreed on the last part. [snip long story] Did you just try to make it simple by showing the comp

Re: Using filepath method to identify an .html page

2013-01-23 Thread Dave Angel
On 01/23/2013 01:36 PM, Mark Lawrence wrote: On 23/01/2013 18:19, Leonard, Arah wrote: 3) This is a Python-specific resource and that's not even Python code. What next? Javascript? Ada? Fortran? COBOL? 8-bit x86 assembly with minimal comments written in Esperanto? Please can we have COR

Re: Increase value in hash table

2013-01-23 Thread Dave Angel
On 01/23/2013 10:39 AM, moonhkt wrote: On Jan 23, 11:33 pm, moonhk wrote: Works. For some definition of 'works" prndev = line.split() # print line for key in prndev : if key in 'lpr': This test will fire if key is the letter "l", or the letter "p"

Re: Arent these snippets equivalent?

2013-01-23 Thread Chris Angelico
On Thu, Jan 24, 2013 at 8:56 AM, Coolgg wrote: > Is this: > > while True: > data = fp.read(4096) > if not data: > break > ... > > not equivalent to this: > > data = fp.read (4096) > while data: > ...{handle the chunk here} > data = fp.read (4096) They should do the sam

Re: Search log for string and display hourly/daily report

2013-01-23 Thread Michael Torrie
On 01/23/2013 12:05 PM, spe...@gmail.com wrote: > I need to search a log file for a specific string (Successfully Sent) > and report the number of instances in the last hour (from when > executed) and total for the day so far (midnight till the time > executed). Can anyone provide any examples of s

Re: Any algorithm to preserve whitespaces?

2013-01-23 Thread Peter Otten
Santosh Kumar wrote: > Yes, Peter got it right. > > Now, how can I replace: > > script, givenfile = argv > > with something better that takes argv[1] as input file as well as > reads input from stdin. > > By input from stdin, I mean that currently when I do `cat foo.txt | > capitalizr` it

Re: Arent these snippets equivalent?

2013-01-23 Thread John Gordon
In Coolgg writes: > Is this: > while True: > data = fp.read(4096) > if not data: > break > ... > not equivalent to this: > data = fp.read (4096) > while data: > ...{handle the chunk here} > data = fp.read (4096) It looks equivalent to me (in terms of control flow

Arent these snippets equivalent?

2013-01-23 Thread Coolgg
Is this: while True: data = fp.read(4096) if not data: break ... not equivalent to this: data = fp.read (4096) while data: ...{handle the chunk here} data = fp.read (4096) Heres the article that sparked this question: http://wordaligned.org/articles/pythons-lesser-kn

Re: Parse a Wireshark pcap file

2013-01-23 Thread Grant Edwards
On 2013-01-23, Kevin Holleran wrote: > Is there a way to parse out a wireshark pcap file and extract key value > pairs from the data? You can use pylibpcap to read pcap files (or to capture live data). I'm afraid I don't know what "parse out" or "extract key value pairs" means. pylibpcap doesn'

Re: Any algorithm to preserve whitespaces?

2013-01-23 Thread Michael Torrie
On 01/23/2013 07:56 AM, Santosh Kumar wrote: > Yes, Peter got it right. > > Now, how can I replace: > > script, givenfile = argv > > with something better that takes argv[1] as input file as well as > reads input from stdin. > > By input from stdin, I mean that currently when I do `cat foo.

Re: Search log for string and display hourly/daily report

2013-01-23 Thread John Gordon
In <4f952e77-258d-47ae-9d76-a86daa8ac...@googlegroups.com> spe...@gmail.com writes: > I need to search a log file for a specific string (Successfully Sent) and > report the number of instances in the last hour (from when executed) and > total for the day so far (midnight till the time executed).

urllib2 FTP Weirdness

2013-01-23 Thread Nick Cash
Python 2.7.3 on linux This has me fairly stumped. It looks like urllib2.urlopen("ftp://some.ftp.site/path";).read() will either immediately return '' or hang indefinitely. But response = urllib2.urlopen("ftp://some.ftp.site/path";) response.read() works fine and returns wha

Re: Search log for string and display hourly/daily report

2013-01-23 Thread Tim Chase
On 01/23/13 13:05, spe...@gmail.com wrote: I need to search a log file for a specific string (Successfully Sent) and report the number of instances in the last hour (from when executed) and total for the day so far (midnight till the time executed). Can anyone provide any examples of such a progr

Search log for string and display hourly/daily report

2013-01-23 Thread spek06
I need to search a log file for a specific string (Successfully Sent) and report the number of instances in the last hour (from when executed) and total for the day so far (midnight till the time executed). Can anyone provide any examples of such a program or get me started? -- http://mail.pyth

Re: Using filepath method to identify an .html page

2013-01-23 Thread Mark Lawrence
On 23/01/2013 18:19, Leonard, Arah wrote: 3) This is a Python-specific resource and that's not even Python code. What next? Javascript? Ada? Fortran? COBOL? 8-bit x86 assembly with minimal comments written in Esperanto? Please can we have CORAL 66 mentioned on the odd occasion. 4) Th

RE: Using filepath method to identify an .html page

2013-01-23 Thread Leonard, Arah
> = > my @i = split(//,$url); # put each letter in it's own bin > my $j=0; # Initailize our > my $k=1; # hashing increment values > my @m=(); # workspace > foreach my $n(@i){ >my $q=ord($n); # ASCII for character >$k += $j;

Re: Memory error with quadratic interpolation

2013-01-23 Thread Isaac Won
On Wednesday, January 23, 2013 10:51:43 AM UTC-6, Oscar Benjamin wrote: > On 23 January 2013 14:57, Isaac Won wrote: > > > On Wednesday, January 23, 2013 8:40:54 AM UTC-6, Oscar Benjamin wrote: > > >> On 23 January 2013 14:28, Isaac Won wrote: > > >> > > [SNIP] > > > > > > Following is full

Re: Uniquely identifying each & every html template

2013-01-23 Thread Dave Angel
On 01/23/2013 05:29 AM, Ferrous Cranus wrote: 1. I'am a troll because i want to generate a solution in a specific way? 2. Am' i not wasting my time trying to reply to everybody? 1) your username is obviously a pseudonym, and identified by multiple websites as a troll. Further, your actio

PDF/A with pyPDF

2013-01-23 Thread Rep. Software - GMG Sistemi Srl
Hi all, I wonder if pyPDF module can manage PDF/A format of PDF... Can anyone tell me? thank you!! === Davide Scatto Resp. Gestionale Gulliver GMG SISTEMI SRL Via Belluno, 43-45 30035 Mirano (VE) e-mail: softw...@gmgsistemi.it Tel.: 041/5703131 (r.

Re: Memory error with quadratic interpolation

2013-01-23 Thread Oscar Benjamin
On 23 January 2013 14:57, Isaac Won wrote: > On Wednesday, January 23, 2013 8:40:54 AM UTC-6, Oscar Benjamin wrote: >> On 23 January 2013 14:28, Isaac Won wrote: >> [SNIP] > > Following is full error message after I adjusted following Ulich's advice: > > interp = interp1d(indices[not_nan], x[not_

Re: Using filepath method to identify an .html page

2013-01-23 Thread Ferrous Cranus
Τη Τετάρτη, 23 Ιανουαρίου 2013 6:33:11 μ.μ. UTC+2, ο χρήστης Leonard, Arah έγραψε: > > "his quote string is Cyrillic"? > > > > > > If you're referring to the "Τη Τρίτη, 22 Ιανουαρίου 2013 6:23:16 μ.μ. > > > UTC+2, ο χρήστης Leonard, Arah έγραψε", that's Greek. > > > > > > Cyrillic or not,

RE: Using filepath method to identify an .html page

2013-01-23 Thread Leonard, Arah
> "his quote string is Cyrillic"? > > If you're referring to the "Τη Τρίτη, 22 Ιανουαρίου 2013 6:23:16 μ.μ. > UTC+2, ο χρήστης Leonard, Arah έγραψε", that's Greek. > Cyrillic or not, it's all Greek to me. ;) -- http://mail.python.org/mailman/listinfo/python-list

RE: Failed to import a "pyd: File When python intepreter embed in C++ project

2013-01-23 Thread Leonard, Arah
> I create a pyd File named "testPyd" with boostPython,and then I import the > testPyd module into "test.py", it works perfect! > But when I embeded the python interpreter into my C++ project and run the > "test.py", it comes out a "ImportErr: no module named testPyd". > It has confused me for tw

Re: Parse a Wireshark pcap file

2013-01-23 Thread John Evans
It looks like there was some very recent reorganization of the scapy packaging on macports, see http://lists.macosforge.org/pipermail/macports-dev/2013-January/021620.html Did you have an updated port tree when you installed? If not, I'd suggest uninstalling whatever port you installed, resync wi

Re: Using filepath method to identify an .html page

2013-01-23 Thread Ferrous Cranus
Τη Τετάρτη, 23 Ιανουαρίου 2013 5:25:36 μ.μ. UTC+2, ο χρήστης Michael Torrie έγραψε: > On 01/23/2013 12:25 AM, Ferrous Cranus wrote: > > > > > > Using that method ABC.html and CBA.html now have different values > > > because each letter position's value gets bumped up increasingly from > > > l

Re: Increase value in hash table

2013-01-23 Thread moonhkt
On Jan 23, 11:33 pm, moonhk wrote: > Works. > >      prndev = line.split() >          # print line >          for key in prndev : >              if key in 'lpr': >                 val = prndev[5].replace("-P","") >                 if val not in printque: >                    printque[val] = 1 >  

Re: Converting a number back to it's original string (that was hashed to generate that number)

2013-01-23 Thread Ferrous Cranus
Τη Τετάρτη, 23 Ιανουαρίου 2013 3:58:45 μ.μ. UTC+2, ο χρήστης Dave Angel έγραψε: > On 01/23/2013 08:38 AM, Ferrous Cranus wrote: > > > Please DON'T tell me to save both the pin <=> filepath and associate them > > (that can be done by SQL commands, i know) > > > I will not create any kind of prima

Re: Increase value in hash table

2013-01-23 Thread moonhk
Works. prndev = line.split() # print line for key in prndev : if key in 'lpr': val = prndev[5].replace("-P","") if val not in printque: printque[val] = 1 else: printque[val] =

Re: Using filepath method to identify an .html page

2013-01-23 Thread Michael Torrie
On 01/23/2013 12:25 AM, Ferrous Cranus wrote: > > Using that method ABC.html and CBA.html now have different values > because each letter position's value gets bumped up increasingly from > left to right. You have run this little "hash" algorithm on a whole bunch of files, say C:\windows\system32

Re: Memory error with quadratic interpolation

2013-01-23 Thread Isaac Won
On Wednesday, January 23, 2013 8:40:54 AM UTC-6, Oscar Benjamin wrote: > On 23 January 2013 14:28, Isaac Won wrote: > > > On Wednesday, January 23, 2013 4:08:13 AM UTC-6, Oscar Benjamin wrote: > > > > > > To Oscar > > > My actual error message is: > > > File > > "/lustre/work/apps/python-2.7

Re: Any algorithm to preserve whitespaces?

2013-01-23 Thread Santosh Kumar
Yes, Peter got it right. Now, how can I replace: script, givenfile = argv with something better that takes argv[1] as input file as well as reads input from stdin. By input from stdin, I mean that currently when I do `cat foo.txt | capitalizr` it throws a ValueError error: Traceback (m

Re: Else statement executing when it shouldnt

2013-01-23 Thread Jerry Hill
On Wed, Jan 23, 2013 at 8:35 AM, Jussi Piitulainen wrote: >> The feature isn't bad, it's just very, very badly named. > > I believe it would read better - much better - if it was "for/then" > and "while/then" instead of "for/else" and "while/else". That's always been my opinion too. I'd remember

Re: Memory error with quadratic interpolation

2013-01-23 Thread Isaac Won
On Wednesday, January 23, 2013 2:55:14 AM UTC-6, Ulrich Eckhardt wrote: > Am 23.01.2013 05:06, schrieb Isaac Won: > > > I have tried to use different interpolation methods with Scipy. My > > > code seems just fine with linear interpolation, but shows memory > > > error with quadratic. I am a nov

Re: Memory error with quadratic interpolation

2013-01-23 Thread Oscar Benjamin
On 23 January 2013 14:28, Isaac Won wrote: > On Wednesday, January 23, 2013 4:08:13 AM UTC-6, Oscar Benjamin wrote: > > To Oscar > My actual error message is: > File > "/lustre/work/apps/python-2.7.1/lib/python2.7/site-packages/scipy/interpolate/interpolate.py", > line 311, in __init__ > se

Re: Uniquely identifying each & every html template

2013-01-23 Thread alex23
On Jan 23, 8:29 pm, Ferrous Cranus wrote: > 1. I'am a troll because i want to generate a solution in a specific way? No, it's because you have the name & behaviour of a known type of troll: As has been pointed out: http://redwing.hutman.net/~mreed/warriorshtm/ferouscranus.htm "Ferrous Cranus i

Re: Memory error with quadratic interpolation

2013-01-23 Thread Isaac Won
On Wednesday, January 23, 2013 4:08:13 AM UTC-6, Oscar Benjamin wrote: > On 23 January 2013 08:55, Ulrich Eckhardt > > > > > Am 23.01.2013 05:06, schrieb Isaac Won: > > > > > >> I have tried to use different interpolation methods with Scipy. My > > >> code seems just fine with linear interpol

Re: Memory error with quadratic interpolation

2013-01-23 Thread Isaac Won
On Wednesday, January 23, 2013 4:08:13 AM UTC-6, Oscar Benjamin wrote: > On 23 January 2013 08:55, Ulrich Eckhardt > > wrote: > > > Am 23.01.2013 05:06, schrieb Isaac Won: > > > > > >> I have tried to use different interpolation methods with Scipy. My > > >> code seems just fine with linear i

Re: Memory error with quadratic interpolation

2013-01-23 Thread Isaac Won
On Tuesday, January 22, 2013 10:06:41 PM UTC-6, Isaac Won wrote: > Hi all, > > > > I have tried to use different interpolation methods with Scipy. My code seems > just fine with linear interpolation, but shows memory error with quadratic. I > am a novice for python. I will appreciate any help.

Re: Multiple postings [was Re: Increase value in hash table]

2013-01-23 Thread rusi
On Jan 23, 3:54 pm, Steven D'Aprano wrote: > Steven D'Aprano wrote: > > I *swear* I only sent it once. Now Now Steven! Good boys dont swear. > Arrgggh, it's happened again. Sorry for the multiple posts folks... > Trying this time with a different news client. Its a law of the universe called k

Re: Parse a Wireshark pcap file

2013-01-23 Thread Kevin Holleran
On Wed, Jan 23, 2013 at 7:25 AM, John Evans wrote: > The import "from scapy.all import *" does work for me with macports and > 10.6.8 When I installed the scapy port, I did see that macports installed > the py27-libdnet package as well. > > >  > > > On Wed, Jan 23, 2013 at 1:24 AM, Dennis Lee Bi

Re: Converting a number back to it's original string (that was hashed to generate that number)

2013-01-23 Thread Dave Angel
On 01/23/2013 08:38 AM, Ferrous Cranus wrote: Please DON'T tell me to save both the pin <=> filepath and associate them (that can be done by SQL commands, i know) I will not create any kind of primary/unique keys to the database. I will not store the filepath into the database, just the number w

Re: Else statement executing when it shouldnt

2013-01-23 Thread Jussi Piitulainen
Thomas Boell writes: > Using a keyword that has a well-understood meaning in just about > every other programming language on the planet *and even in > English*, redefining it to mean something completely different, and > then making the syntax look like the original, well-understood > meaning --

Re: Converting a number back to it's original string (that was hashed to generate that number)

2013-01-23 Thread Ferrous Cranus
Please DON'T tell me to save both the pin <=> filepath and associate them (that can be done by SQL commands, i know) I will not create any kind of primary/unique keys to the database. I will not store the filepath into the database, just the number which indicates the filepath(html page). Also no

Re: Converting a number back to it's original string (that was hashed to generate that number)

2013-01-23 Thread newspost2012
please don't feed the troll. cu, Kurt -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a number back to it's original string (that was hashed to generate that number)

2013-01-23 Thread Lele Gaifax
Ferrous Cranus writes: > pin = int( htmlpage.encode("hex"), 16 ) % 10 > > Now i need the opposite procedure. As already said several times by different persons in this thread, there is no way you can get the original string that originated a particular “pin”: the function you are using is “l

Re: Uniquely identifying each & every html template

2013-01-23 Thread Ferrous Cranus
Τη Τετάρτη, 23 Ιανουαρίου 2013 2:03:51 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε: > On Wed, Jan 23, 2013 at 5:29 AM, Ferrous Cranus wrote: > > Τη Τετάρτη, 23 Ιανουαρίου 2013 11:37:29 π.μ. UTC+2, ο χρήστης alex23 έγραψε: > > > > On Jan 23, 7:12 pm, Ferrous Cranus wrote: > > > > > > > They

Re: Parse a Wireshark pcap file

2013-01-23 Thread John Evans
The import "from scapy.all import *" does work for me with macports and 10.6.8 When I installed the scapy port, I did see that macports installed the py27-libdnet package as well. On Wed, Jan 23, 2013 at 1:24 AM, Dennis Lee Bieber wrote: > On Tue, 22 Jan 2013 22:43:24 -0500, Kevin Holleran

Converting a number back to it's original string (that was hashed to generate that number)

2013-01-23 Thread Ferrous Cranus
Now my website finally works as intended. Just visit the following links plz. -- 1. http://superhost.gr 2. http://superhost.gr/?show=log 3. http://i.imgur.com/89Eqmtf.png (this displays the database's column 'pin',

Re: Uniquely identifying each & every html template

2013-01-23 Thread Joel Goldstick
On Wed, Jan 23, 2013 at 5:29 AM, Ferrous Cranus wrote: > Τη Τετάρτη, 23 Ιανουαρίου 2013 11:37:29 π.μ. UTC+2, ο χρήστης alex23 > έγραψε: > > On Jan 23, 7:12 pm, Ferrous Cranus wrote: > > > > > They are getting frustrated because they do not want to follow the > logic i'am imposing. > > > > > > > >

Oportunidade: Programador Python Pleno / RJ

2013-01-23 Thread zughumancapital
Arpex Capital seleciona para uma de suas startups: Programador Python Pleno Descrição: Programador para Web Crawler Python - Experiência mínima de 1 ano em python - Conhecimento de padrões de projeto - Sólido conhecimento OO - Ser auto-gerenciável - Conhecimento de SQL Desejável: - Ter gi

Re: Understanding while...else...

2013-01-23 Thread Jean-Michel Pichavant
- Original Message - > Several people have trouble understanding Python's while-else and > for-else constructs. It is actually quite simple agreed on the last part. [snip long story] Did you just try to make it simple by showing the compiled code ? I'm quite not sure about that... JM

Re: Else statement executing when it shouldnt

2013-01-23 Thread Thomas Boell
On Tue, 22 Jan 2013 17:28:35 -0800 (PST) alex23 wrote: > On Jan 23, 1:48 am, Thomas Boell wrote: > > I must say, that's bound to be confusing for anyone who knows any > > language other than Python (or none, even).  Syntax like that is "an > > accident waiting to happen"... > > No, ignorantly e

Re: Understanding while...else...

2013-01-23 Thread Oscar Benjamin
On 23 January 2013 11:03, René Klačan wrote: > On Wed, Jan 23, 2013 at 1:39 AM, Oscar Benjamin > wrote: You missed off an important piece of context in your post: >> I think he meant that he would use the else clause more often if it >> had the semantics so that the two blocks below were equiv

Multiple postings [was Re: Increase value in hash table]

2013-01-23 Thread Steven D'Aprano
Steven D'Aprano wrote: [snip content] Arrgggh, it's happened again. Sorry for the multiple posts folks, I *swear* I only sent it once. Trying this time with a different news client. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Increase value in hash table

2013-01-23 Thread Steven D'Aprano
On Wed, 23 Jan 2013 10:12:25 +, Oscar Benjamin wrote: > You can't retrieve the value of printque[val] if you haven't yet added > an entry with the key val to the dict. Try this: > > if val not in printque: > printque[val] = 1 > else: > printque[val] = printque[val] + 1 Another way of

Re: Increase value in hash table

2013-01-23 Thread Steven D'Aprano
On Wed, 23 Jan 2013 10:12:25 +, Oscar Benjamin wrote: > You can't retrieve the value of printque[val] if you haven't yet added > an entry with the key val to the dict. Try this: > > if val not in printque: > printque[val] = 1 > else: > printque[val] = printque[val] + 1 Another way of

Re: Increase value in hash table

2013-01-23 Thread Steven D'Aprano
On Wed, 23 Jan 2013 10:12:25 +, Oscar Benjamin wrote: > You can't retrieve the value of printque[val] if you haven't yet added > an entry with the key val to the dict. Try this: > > if val not in printque: > printque[val] = 1 > else: > printque[val] = printque[val] + 1 Another way of

Re: Understanding while...else...

2013-01-23 Thread René Klačan
> > # Version 1 > while condition: > # stuff > else: > # other stuff > > # Version 2 > if condition: > while condition: > # stuff > else: > # other stuff > they wouldnt be equivalent if #staff in version did not cointain "break" statement and this is common mistake On Wed,

Re: Understanding while...else...

2013-01-23 Thread René Klačan
they wouldnt be equivalent if #staff in version 1 did not cointain "break" statement and this is common mistake On Wed, Jan 23, 2013 at 1:39 AM, Oscar Benjamin wrote: > On 22 January 2013 23:41, Terry Reedy wrote: > > On 1/22/2013 3:09 PM, Ethan Furman wrote: > >> > >> On 01/22/2013 09:44 AM, Te

Re: Increase value in hash table

2013-01-23 Thread Steven D'Aprano
On Wed, 23 Jan 2013 10:12:25 +, Oscar Benjamin wrote: > You can't retrieve the value of printque[val] if you haven't yet added > an entry with the key val to the dict. Try this: > > if val not in printque: > printque[val] = 1 > else: > printque[val] = printque[val] + 1 Another way of

Re: Any algorithm to preserve whitespaces?

2013-01-23 Thread Dave Angel
On 01/23/2013 04:20 AM, Santosh Kumar wrote: I am in a problem. words = line.split(' ') preserve whitespaces but the problem is it writes an additional line after every line. Think about what you said. It might be clearer if you wrote: "but the problem is it doesn't strip off the newl

Re: Uniquely identifying each & every html template

2013-01-23 Thread Ferrous Cranus
Τη Τετάρτη, 23 Ιανουαρίου 2013 11:37:29 π.μ. UTC+2, ο χρήστης alex23 έγραψε: > On Jan 23, 7:12 pm, Ferrous Cranus wrote: > > > They are getting frustrated because they do not want to follow the logic > > i'am imposing. > > > > No, it's because you're an obvious troll and you're wasting everyo

Re: Increase value in hash table

2013-01-23 Thread Oscar Benjamin
On 23 January 2013 07:26, moonhkt wrote: > Hi Al > > I have Data file have below > > Data file > V1 > V2 > V3 > V4 > V4 > V3 > > How to using count number of data ? > > Output > V1 = 1 > V2 = 1 > V3 =2 > V4 = 2 > > > > # Global Veriable > printque = {} > in def have below > > printque[val] = prin

Re: Memory error with quadratic interpolation

2013-01-23 Thread Oscar Benjamin
On 23 January 2013 08:55, Ulrich Eckhardt wrote: > Am 23.01.2013 05:06, schrieb Isaac Won: > >> I have tried to use different interpolation methods with Scipy. My >> code seems just fine with linear interpolation, but shows memory >> error with quadratic. I am a novice for python. I will appreciat

Re: Retrieving the full command line

2013-01-23 Thread Oscar Benjamin
On 23 January 2013 03:58, Steven D'Aprano wrote: > On Wed, 23 Jan 2013 00:53:21 +, Oscar Benjamin wrote: > >> On 22 January 2013 23:46, Steven D'Aprano >> wrote: [SNIP] >>> >> The purpose of the -m option is that you can run a script that is >> located via the Python import path instead of an

Re: Retrieving the full command line

2013-01-23 Thread Tim Golden
On 23/01/2013 03:58, Steven D'Aprano wrote: > Currently, if I have a package __main__.py that prints sys.argv, I get > results like this: > > steve@runes:~$ python3.3 /home/steve/python/testpackage/__main__.py ham > spam eggs > ['/home/steve/python/testpackage/__main__.py', 'ham', 'spam', 'eggs'

Re: Importing class from another file

2013-01-23 Thread Tobias M.
Hi, Kevin Holleran wrote: Traceback (most recent call last): File "testing.py", line 1, in from Sub_Dir.My_Class import * ImportError: No module named Sub_Dir.My_Class Make sure, the script you execute by passing it to the python interpreter is in the parent directory of Sub_Dir. A

Re: Uniquely identifying each & every html template

2013-01-23 Thread Mark Lawrence
On 23/01/2013 09:37, alex23 wrote: On Jan 23, 7:12 pm, Ferrous Cranus wrote: They are getting frustrated because they do not want to follow the logic i'am imposing. No, it's because you're an obvious troll and you're wasting everyone's time. Now be a good lad and sod off. What an appalli

Re: Any algorithm to preserve whitespaces?

2013-01-23 Thread Peter Otten
Santosh Kumar wrote: > I am in a problem. > > words = line.split(' ') > > preserve whitespaces but the problem is it writes an additional line > after every line. Strip off the newline at the end of the line with: line = line.rstrip("\n") words = line.split(" ") -- http://mail.python.o

Re: Uniquely identifying each & every html template

2013-01-23 Thread alex23
On Jan 23, 7:12 pm, Ferrous Cranus wrote: > They are getting frustrated because they do not want to follow the logic i'am > imposing. No, it's because you're an obvious troll and you're wasting everyone's time. Now be a good lad and sod off. -- http://mail.python.org/mailman/listinfo/python-li

Re: Increase value in hash table

2013-01-23 Thread moonhkt
On Jan 23, 3:34 pm, Chris Rebert wrote: > On Jan 22, 2013 11:31 PM, "moonhkt" wrote: > > > > > > > > > > > > > Hi Al > > > I have Data file have below > > > Data file > > V1 > > V2 > > V3 > > V4 > > V4 > > V3 > > > How to using count number of data ? > > > Output > > V1 = 1 > > V2 = 1 > > V3 =2 >

Re: Any algorithm to preserve whitespaces?

2013-01-23 Thread Santosh Kumar
I am in a problem. words = line.split(' ') preserve whitespaces but the problem is it writes an additional line after every line. And: words = line.split() works as I expect (does not adds addition line after every line) but does not preserves whitespaces. -- http://mail.python.org/m

Re: Memory error with quadratic interpolation

2013-01-23 Thread Ulrich Eckhardt
Am 23.01.2013 05:06, schrieb Isaac Won: I have tried to use different interpolation methods with Scipy. My code seems just fine with linear interpolation, but shows memory error with quadratic. I am a novice for python. I will appreciate any help. > #code f = open(filin, "r") Check out the "w

  1   2   >