Christopher Spears schreef:
> 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:
> fl
Christopher Spears schreef:
> 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:
> fl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Everyone
I did a comparison of the output between the perl and python methodology.
They do basically the same thing but the perl form seems to be more "true"
The python method inserts extra blank lines after each hex value line.
For example:
O
Andrew Robert wrote:
> The python method inserts extra blank lines after each hex value line.
> Does anyone know why this might be?
>
> Is the print statement inserting a artificial new line character?
Yes, this is a feature of print, it always inserts a newline. To avoid
this, use sys.stdout.wr
On 5/25/06, Richard Harding <[EMAIL PROTECTED]> wrote:
Andre Roberge wrote:> ===Now the question===> 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 o
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Great!
Taking this a little further along, I wrote the converted file to a new
file using:
import re,sys
output = open(r'e:\pycode\out_test.txt','wb')
for line in open(r'e:\pycode\sigh.txt','rb') :
output.write( re.sub(r'([^\w\s])', lambda s:
Hey
I have a script that logs into a remote terminal over ssh and executes a script i.e.
1. Script logs into remote terminal over ssh
2. Executes another script that resides on the remote terminal, with
the command 'child.sendline(cmdString)', where cmdString is a reference
to the local script be
Andrew Robert wrote:
> Taking this a little further along, I wrote the converted file to a new
> file using:
>
>
> import re,sys
>
> output = open(r'e:\pycode\out_test.txt','wb')
>
> for line in open(r'e:\pycode\sigh.txt','rb') :
> output.write( re.sub(r'([^\w\s])', lambda s: '%%%2X' %
> or
Andre Roberge schreef:
> Thank you Rick (and Alan) for your suggestions which I forwarded to
> Catherine, would-be-user of Crunchy Frog. Apparently Catherine was
> using port 8080 as a proxy server; changing it made everything work.
> This also tells me that I should use a different number as
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi all,
I tried:
output = open(r'e:\pycode\new_test.txt','wb')
for line in open(r'e:\pycode\out_test.txt','rb') :
output.write( re.sub(r'([^\w\s])', lambda s: chr(int(s.group(),
16))) % ord(s.group()), line))
This generated the traceback:
Fi
Andrew Robert wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi all,
>
> I tried:
>
>
> output = open(r'e:\pycode\new_test.txt','wb')
>
> for line in open(r'e:\pycode\out_test.txt','rb') :
> output.write( re.sub(r'([^\w\s])', lambda s: chr(int(s.group(),
> 16))) % ord(s.group
> for line in open(r'e:\pycode\out_test.txt','rb') :
>output.write( re.sub(r'([^\w\s])', lambda s: chr(int(s.group(),
> 16))) % ord(s.group()), line))
Let's add some whitespace.
output.write(re.sub(r'([^\w\s])',
lambda s: chr(
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
When I alter the code to:
import re,sys
output = open(r'e:\pycode\new_test.txt','wb')
for line in open(r'e:\pycode\out_test.txt','rb') :
output.write( re.sub(r'([^\w\s])', lambda s: chr(int(s.group(), 16)))
, line)
output.close()
I get the trac
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
lol..
Glutton for punishment I guess.
I tried removing the last parentheses but I then get an error that two
arguments are passed when three are expected.
Danny Yoo wrote:
>
>
>> for line in open(r'e:\pycode\out_test.txt','rb') :
>>output.w
Andrew Robert wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> When I alter the code to:
>
> import re,sys
>
> output = open(r'e:\pycode\new_test.txt','wb')
>
> for line in open(r'e:\pycode\out_test.txt','rb') :
>output.write( re.sub(r'([^\w\s])', lambda s: chr(int(s.group(), 16
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Kent,
Sorry for causing so much trouble.
I am not married to either a single or multi-line solution one way or
another.
Just a solution that works.
Based on something by Danny Yoo provided, I had started with something like:
import re,base6
I have 2 questions I'm curious about (BTW, I use the default
python installation as delivered with Linux SuSe 10.0)
(1) How can I print the path to the python I'm using and where
it imports built-in modules?
python.sys returns (i probably want 64bit, so this seems ok):
/usr/lib/python24.zip
/usr/
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Everyone,
Thanks for all of your patience on this.
I finally got it to work.
Here is the completed test code showing what is going on.
Not cleaned up yet but it works for proof-of-concept purposes.
#!/usr/bin/python
import re,base64
# Eva
I'm debugging a program where I'm trying to import a file named xxx.pyd.
I test the logic interactively with IDLE and see that it makes a difference
on which directory the file xxx.pyd is located. That is, I can get it to
work when xxx.pyd is on the path.
However, when I run the program in bat
I have a series of lists to compare with a list of exclusionary terms.
junkList =["interchange", "ifferen", "thru"]
The comparison lists have one or more elements, which may or may not contain the junkList elements somewhere within:
l = ["My skull hurts", "Drive the thruway", "Interchangabili
On Thu, 25 May 2006, Alan Gauld wrote:
> In general I prefer to use string formatting to convert into hex
> format.
I'm a big fan of hexlify:
>>> from binascii import hexlify
>>> s="abc-123"
>>> hexlify(s)
'6162632d313233'
___
Tutor maillist - Tu
On Thu, 25 May 2006, Kent Johnson wrote:
> Yes, this is a feature of print, it always inserts a newline.
Well, you can get rid of the newline by ending with a comma, but it still
will insert spaces:
>>> for ch in "abc":
... print ch
...
a
b
c
>>> for ch in "abc":
... print ch,
...
a b c
>>>
> for line in open(r'e:\pycode\out_test.txt','rb') :
>output.write( re.sub(r'([^\w\s])', lambda s: chr(int(s.group(),
> 16))) % ord(s.group()), line))
>
> This generated the traceback:
>
> File "E:\pycode\sample_decode_file_specials_from_hex.py", line 8
>output.write( re.sub(r'([^\w\s])', l
> And "whereis python" returns
> python: /usr/bin/python /usr/bin/python2.4 /usr/lib/python2.4
> /usr/include/python /usr/include/python2.4
> /usr/share/man/man1/python.1.gz
>
> Does this mean I am using the python executable in
> "/usr/bin/python/" but it then looks for built-in modules in
> "
doug shawhan wrote:
> I have a series of lists to compare with a list of exclusionary terms.
>
>
>
> junkList =["interchange", "ifferen", "thru"]
>
> The comparison lists have one or more elements, which may or may not
> contain the junkList elements somewhere within:
>
> l = ["My skull hurts", "
doug shawhan wrote:
> I have a series of lists to compare with a list of exclusionary terms.
>
> junkList =["interchange", "ifferen", "thru"]
>
> The comparison lists have one or more elements, which may or may not
> contain the junkList elements somewhere within:
>
> l = ["My skull hurts", "D
hello list,i am having a problem getting crontab to execute a
python script. the script works because i can execute it by using:
python boxster_school_smtp.py from a command line. i put a line in
crontab that look like this:
i know this is not a linux mailing list but any help would be appreciated.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Daniel McQuay wrote, On 05/25/2006 09:24 PM:
> Traceback (most recent call last):
> File "/root/scripts/boxster_school_smtp.py", line 19, in ?
>mssg = open('mssg.txt', 'r').read()
> IOError: [Errno 2] No such file or directory: ' emmssg.txt'
>
Ri
28 matches
Mail list logo