apologies if this doesn't belong on tutor.
i have a long-running script that manages a bunch of sockets with asyncore,
opening 600 connections every 30 seconds for short transactions, and every
now and then (like anywhere from twice an hour to once every few hours) i
get this weird error: "filedes
bhaaluu wrote:
> Greetings,
>
>>From what I can tell of this "decoding" function, it uses
> the chr() function to return the ascii character:
>
print chr(eval('65'))
> A
There is no need to use eval() here. Since the expected values are
integers, just use int():
In [6]: chr(int('65'))
Out[
--- bhaaluu <[EMAIL PROTECTED]> wrote:
> Greetings,
>
> From what I can tell of this "decoding" function, it
> uses
> the chr() function to return the ascii character:
>
> >>> print chr(eval('65'))
> A
>
> >>> print ord('A')
> 65
>
> In this textbook example, the "code" is simple a
> string o
--- bhaaluu <[EMAIL PROTECTED]> wrote:
> Greetings,
>
> From what I can tell of this "decoding" function, it
> uses
> the chr() function to return the ascii character:
>
> >>> print chr(eval('65'))
> A
>
> >>> print ord('A')
> 65
>
> In this textbook example, the "code" is simple a
> string of
Eric Walker wrote:
> newbie here,
>
Welcome
> I just tried playing around with the dec function and
> I get errors.
Please always post the traceback (error message), and the code you are
using.
> Correct me if I am wrong. After getting
> the input,
What input is dec() expecting? As I read it
Greetings,
>From what I can tell of this "decoding" function, it uses
the chr() function to return the ascii character:
>>> print chr(eval('65'))
A
>>> print ord('A')
65
In this textbook example, the "code" is simple a string of the
ASCII characters' numeric values. Nothing fancy.
What does th
newbie here,
I just tried playing around with the dec function and
I get errors. Correct me if I am wrong. After getting
the input, the string.split will parse the string
across whitespace chars so in other words you get a
list of each word entered. Then when it does the
eval(x) part it dies. I tri
Thanks, it really works.
On 8/13/07, bhaaluu <[EMAIL PROTECTED]> wrote:
>
> Greetings,
>
> Disclaimer: I'm a Python Noob,
> so use the code snippets
> in this post, at your own risk!
>
> Is this what you're looking for?
>
> def dec(a):
> import string
> result=''
> for x in string.spl
At 02:12 PM 8/12/2007, Dick Moores wrote:
At 01:15 PM 8/12/2007, Khamid
Nurdiev wrote:
Hello All,
I am currently learning python with the book "Python
programming: An introduction to CS" by John M. Zelle and have come
the section where he speaks of encoding messages. Currently the basic
snippet
At 01:15 PM 8/12/2007, Khamid Nurdiev wrote:
Hello All,
I am currently learning python with the book "Python
programming: An introduction to CS" by John M. Zelle and have come
the section where he speaks of encoding messages. Currently the basic
snippet looks like this:
def dec():
import
Greetings,
Disclaimer: I'm a Python Noob,
so use the code snippets
in this post, at your own risk!
Is this what you're looking for?
def dec(a):
import string
result=''
for x in string.split(a):
result=result+chr(eval(x))
return result
print dec(raw_input("Enter the messa
Hello All,
I am currently learning python with the book "Python programming: An
introduction to CS" by John M. Zelle and have come the section where he
speaks of encoding messages. Currently the basic snippet looks like this:
def dec():
> > import string
> > message=raw_input("Enter the m
Thank you, sorry for the repeat question.
On 8/11/07, Luke Paireepinart <[EMAIL PROTECTED]> wrote:
> It depends whether IDLE is opened with a subprocess or not. If it's a
> subprocess, your program will have a separate interpreter entirely from
> that used by IDLE, so the namespace will be the de
13 matches
Mail list logo