Hi all-===Preliminaries===I wrote a new app (Crunchy Frog) which is meant to transform "boring" traditional python tutorial into truly interactive experiences. It is still at an alpha stage but is promising imo; for those interested, you can find it at:
https://sourceforge.net/project/showfiles.ph
> Your code put me right on track.
>
> - From that point, I crafted the following code.
>
> What is confusing is how to take the captured character and
> transform it
> into a 3 digit hex value.
In general I prefer to use string formatting to convert into hex
format.
print "%3X% % myValue
you
> a = open(r'e:\pycode\csums.txt','rb').readlines()
>
> for line in a:
>print re.sub(r'([^\w\s])', lambda s: '%%%2X' % ord(s.group()),
> line)
Or just
for line in open(r'e:\pycode\csums.txt','rb'):
print.
> Breaking down the command, you appear to be calling an un-named
> function
>
> I understand that the class is taking the strings from
> stdout (supplied by the print statements) and writing
> them to a text file. Does the user need to explicitly
> call the write function? For example:
>
> sys.stdout = Writer('tmp.log').write(whatever the
> message is)
No, that's what pr
> Someone on edu-sig tried to get it working on her computer running Windows
> XP home edition (just like mine, where it works fine!). However, she gets an
> error message about
> " port 8080 not free on local host." This is after she made sure nothing
> else internet-related was working. [This
Christopher Spears wrote:
> How does this script work?
>
> #!/usr/bin/python
>
> class IteratorExample:
> def __init__(self, s):
> self.s = s
> self.next = self._next().next
> self.exhausted = 0
> def _next(self):
> if not self.exhausted:
> flag
How does this script work?
#!/usr/bin/python
class IteratorExample:
def __init__(self, s):
self.s = s
self.next = self._next().next
self.exhausted = 0
def _next(self):
if not self.exhausted:
flag = 0
for x in self.s:
Andrew Robert wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Wow!!..
>
> That awesome!
>
>
> My goal was not to make it a one-liner per-se..
>
> I was simply trying to show the functionality I was trying to duplicate.
>
> Boiling your one-liner down into a multi-line piece of co
[message re-sent; original seemed not to have been received, according to the archives. Apologies if this is not the case.]Hi all-===Preliminaries===I wrote a new app (Crunchy Frog)
which is meant to transform "boring" traditional python tutorial into
truly interactive experiences. It is still at
On Wed, 24 May 2006, Christopher Spears wrote:
> I've been working my way through an online tutorial and came across the
> following sample script:
>
> import sys
>
> class Writer:
>def __init__(self, filename):
>self.filename = filename
>def write(self, msg):
>f = file(
[forwarding to tutor, although it looks like Andrew's making some good
headway from other messages]
-- Forwarded message --
Date: Wed, 24 May 2006 14:59:43 -0400
From: Andrew Robert <[EMAIL PROTECTED]>
To: Danny Yoo <[EMAIL PROTECTED]>
Subject: Re: [Tutor] Question on regular expr
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Wow!!..
That awesome!
My goal was not to make it a one-liner per-se..
I was simply trying to show the functionality I was trying to duplicate.
Boiling your one-liner down into a multi-line piece of code, I did:
#!c:\python24\python
import re,sys
I've been working my way through an online tutorial
and came across the following sample script:
import sys
class Writer:
def __init__(self, filename):
self.filename = filename
def write(self, msg):
f = file(self.filename, 'a')
f.write(msg)
f.close()
sys.s
On 24 Mai 2006, [EMAIL PROTECTED] wrote:
> I have two Perl expressions
>
>
> If windows:
>
> perl -ple "s/([^\w\s])/sprintf(q#%%%2X#, ord $1)/ge" somefile.txt
>
> If posix
>
> perl -ple 's/([^\w\s])/sprintf("%%%2X", ord $1)/ge' somefile.txt
>
>
>
> The [^\w\s] is a negated expression stating th
On Wed, 2006-05-24 at 18:18 -0400, Daniel McQuay wrote:
> Hello List,
>
> I am rather new to programming and I was wondering y'all think the
> best way to configure a cisco router using python would be. currently
> I am using telnetlib. my problem is, I get an error after connecting
> to the route
On 25/05/06, Andrew Robert <[EMAIL PROTECTED]> wrote:
> If the 0X21 is the actual hex value, then why convert to integer?
>
> Is this the ASCII table reference to the hex value?
Hi Andrew,
There is a difference between a number and the representation of that number.
For example, there is a numbe
Hello List,I am rather new to programming and I was wondering y'all think the best way to configure a cisco router using python would be. currently I am using telnetlib. my problem is, I get an error after connecting to the router. here is the error I get when I use IDLE:
Enter IP: 205.180.0.3Warni
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Everyone,
I am trying to understand conversion of a value to hex.
Could you please confirm that what I am doing is right?
Get the hex value of ! and store it in a
a=hex(ord('!'))
print a
0X21
I see examples including this kind of a statement bu
> perl -ple "s/([^\w\s])/sprintf(q#%%%2X#, ord $1)/ge" somefile.txt
Hi Andrew,
Give me a second. I'm trying to understand the command line switches:
(Looking in 'perl --help'...)
-p assume loop like -n but print line also, like sed
-l[octal] enable line ending proce
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Everyone,
I have two Perl expressions
If windows:
perl -ple "s/([^\w\s])/sprintf(q#%%%2X#, ord $1)/ge" somefile.txt
If posix
perl -ple 's/([^\w\s])/sprintf("%%%2X", ord $1)/ge' somefile.txt
The [^\w\s] is a negated expression stating th
Matt- Have you tried running this line-by-line in IDLE? I've done a script
almost exactly the same as what you're doing ( I downloaded a .jpg file from
a web-server ), and when I was trying to learn what commands did what, I
quickly changed from trying to write a 'program' to running lines
ind
rio wrote:
> I'm developing an application to do interlineal (an extreme type of
> literal) translations of natural language texts and xml. Here's an example
> of a text:
>
> '''Para eso son los amigos. Para celebrar las gracias del otro.'''
>
> and the expected translation with all of the origin
I'm developing an application to do interlineal (an extreme type of
literal) translations of natural language texts and xml. Here's an example
of a text:
'''Para eso son los amigos. Para celebrar las gracias del otro.'''
and the expected translation with all of the original tags, whitespace,
etc
23 matches
Mail list logo