David | 1 Apr 2009 01:51
Favicon

Re: Operational Error. --HELP

bijoy franco wrote:
> I tried following query as well.
> 
> code:
> infunction_curs.execute('SELECT * FROM table_book')
> 
> This also throws the same error
> 
> Bijoy

Why did you try that?

--

-- 
Powered by Gentoo GNU/LINUX
http://www.linuxcrazy.com
pgp.mit.edu

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Mark Tolonen | 1 Apr 2009 03:08
Picon

Re: how are unicode chars represented?


"Kent Johnson" <kent37 <at> tds.net> wrote in message 
news:1c2a2c590903310357m682e16acr9d94b12b609939d5 <at> mail.gmail.com...
On Tue, Mar 31, 2009 at 1:52 AM, Mark Tolonen <metolone+gmane <at> gmail.com> 
wrote:

>> Unicode is simply code points. How the code points are represented
>> internally is another matter. The below code is from a 16-bit Unicode 
>> build
>> of Python but should look exactly the same on a 32-bit Unicode build;
>> however, the internal representation is different.
>>
>> Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit 
>> (Intel)]
>> on win32
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>>
>>>>> x=u'\U00012345'
>>>>> x.encode('utf8')
>>
>> '\xf0\x92\x8d\x85'
>>
>> However, I wonder if this should be considered a bug. I would think the
>> length of a Unicode string should be the number of code points in the
>> string, which for my string above should be 1. Anyone have a 32-bit 
>> Unicode
>> build of Python handy? This exposes the implementation as UTF-16.
>>>>>
>>>>> len(x)
>>
(Continue reading)

Wayne Watson | 1 Apr 2009 06:38
Picon
Favicon

Default Structure of a 640x480 PIL BMP File?

See Subject. Does it have a header, DIB,  palette, and data section?
--
Signature.html Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) The Obama Administration plans to double the production in solar energy from 1% to 2% of the total energy supply in the next few years. One nuclear reaction would do the same. Heard on Bill Wattenburg, KGO-AM "Less than all cannot satisfy Man." -- William Blake
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor
Jared White | 1 Apr 2009 12:06
Picon

My Program stopped working, can anyone help

I am trying to produce A Caesar cipher is a simple substitution cipher , that would code For example, if the key value is 2, the word “Sourpuss” would be encoded as “Uqwtrwuu

Here is my code: ( but i keep getting a ERROR) It works for me Last week but for some reason it isnt work for me right now. ANY REASON WHY PLEASE HELP

# alphabet.py
# Simple string processing program to generate an encryp text


def main():
print "This program will encode your messages using a Caesar Cipher"
print
key = input("Enter the key: ")
message = raw_input("Enter the message: ")
codedMessage = ""
for ch in message:
codedMessage = codedMessage + chr(ord(ch) + key)
print "The coded message is:", codedMessage


main()
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor
Padmanaban Ganesan | 1 Apr 2009 12:24
Picon

Re: My Program stopped working, can anyone help

Hi Jared,
 
This is program is working fine for me.
Please check the indentation is proper in it.
 
 
def main():
 print "This program will encode your messages using a Caesar Cipher"
print
key = input("Enter the key: ")
message = raw_input("Enter the message: ")
codedMessage = ""
for ch in message:
 codedMessage = codedMessage + chr(ord(ch) + key)
print "The coded message is:", codedMessage

main()
 
Sample Execution:
----------------------------
 
Enter the key: 123
Enter the message: Hi Paddy
The coded message is: Ãä›ËÜßßô
This program will encode your messages using a Caesar Cipher
 
 
--
Ta,
Paddy
"The Secret to creativity is knowing how to hide your sources "
 
 
2009/4/1 Jared White <dukelx2005 <at> gmail.com>
I am trying to produce A Caesar cipher is a simple substitution cipher , that would code For example, if the key value is 2, the word “Sourpuss” would be encoded as “Uqwtrwuu

Here is my code: ( but i keep getting a ERROR) It works for me Last week but for some reason it isnt work for me right now. ANY REASON WHY PLEASE HELP

# alphabet.py
# Simple string processing program to generate an encryp text


def main():
print "This program will encode your messages using a Caesar Cipher"
print
key = input("Enter the key: ")
message = raw_input("Enter the message: ")
codedMessage = ""
for ch in message:
codedMessage = codedMessage + chr(ord(ch) + key)
print "The coded message is:", codedMessage


main()

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor





_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor
Kent Johnson | 1 Apr 2009 13:00
Gravatar

Re: My Program stopped working, can anyone help

On Wed, Apr 1, 2009 at 6:06 AM, Jared White <dukelx2005 <at> gmail.com> wrote:
> I am trying to produce A Caesar cipher is a simple substitution cipher ,
> that would code For example, if the key value is 2, the word “Sourpuss”
> would be encoded as “Uqwtrwuu
>
> Here is my code: ( but i keep getting a ERROR) It works for me Last week but
> for some reason it isnt work for me right now. ANY REASON WHY PLEASE HELP
>
> # alphabet.py
> # Simple string processing program to generate an encryp text
>
>
> def main():
> print "This program will encode your messages using a Caesar Cipher"
> print
> key = input("Enter the key: ")
> message = raw_input("Enter the message: ")
> codedMessage = ""
> for ch in message:
> codedMessage = codedMessage + chr(ord(ch) + key)
> print "The coded message is:", codedMessage
>
>
> main()

Please be more specific. What input are you giving? What error do you get?

What is the value of chr(ord(ch) + key) when ch is 'z' and key is 10?
Is that what you want?

Kent
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Richard Lovely | 1 Apr 2009 19:14
Gravatar

Fwd: range() fractional increment

forgot to reply-all...

---------- Forwarded message ----------
From: Richard Lovely <roadierich <at> googlemail.com>
Date: 1 Apr 2009 18:13
Subject: Re: [Tutor] range() fractional increment
To: Alan Gauld <alan.gauld <at> btinternet.com>

There's always the itertools solution:

import itertools
def rangeInThirds(start,end):
   for whole, frac in itertools.product(range(start,end), (0, 0.3, 0.6)):
       yield whole + frac

The simplist way is to use a list comprehension:
[whole + frac for whole in xrange(start, end) for frac in [0, 0.3, 0.6]]

Then you just need to turn the iterable (generator in the first case,
list in the second into your "array".

On 31/03/2009, Alan Gauld <alan.gauld <at> btinternet.com> wrote:
>
> "james carnell" <jimcarnell <at> yahoo.com> wrote
>
> > example:
> > x0000 row = 25 : col = 10
> > x0000 row = 26 : col = 10.3
> > x0000 row = 27 : col = 10.6
> > 0x000 row = 28 : col = 11
> >
>
> > for col in range(10,12, 0.3): #<- Crash Bang doesn't work 0.3 = zero =
> infinite loop?
> >
>
> If you know the limits (rather than their being variables) you can do
>
> for n in range(100,120,3)
>    n = n/10
>
> But if you have variable range limits then a generator
> or while loop are your best bets I think.
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/l2p/
>
> _______________________________________________
> Tutor maillist  -  Tutor <at> python.org
> http://mail.python.org/mailman/listinfo/tutor
>

--
Richard "Roadie Rich" Lovely, part of the JNP|UK Famile
www.theJNP.com

--

-- 
Richard "Roadie Rich" Lovely, part of the JNP|UK Famile
www.theJNP.com
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

bob gailer | 1 Apr 2009 21:40
Picon

Re: My Program stopped working, can anyone help

Jared White wrote:
> I am trying to produce A Caesar cipher is a simple substitution cipher 
> , that would code For example, if the key value is 2, the word 
> “Sourpuss” would be encoded as “Uqwtrwuu
>
> Here is my code: ( but i keep getting a ERROR)
1 - I see no indentation. Please fix that and repost.
2 - Also post the traceback that is reporting the error. We are not psychic!
3 - be sure to reply to the list.

> It works for me Last week but for some reason it isnt work for me 
> right now. ANY REASON WHY PLEASE HELP :(
>
> # alphabet.py
> # Simple string processing program to generate an encryp text
>
>
> def main():
> print "This program will encode your messages using a Caesar Cipher"
> print
> key = input("Enter the key: ")
> message = raw_input("Enter the message: ")
> codedMessage = ""
> for ch in message:
> codedMessage = codedMessage + chr(ord(ch) + key)
> print "The coded message is:", codedMessage
>
>
> main()
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist  -  Tutor <at> python.org
> http://mail.python.org/mailman/listinfo/tutor
>   

--

-- 
Bob Gailer
Chapel Hill NC
919-636-4239
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Alan Gauld | 1 Apr 2009 23:03

Re: Left Alignment -- Tkinter


"W W" <srilyk <at> gmail.com> wrote

> Good news... I got it!
>
> Here's something that's often a good idea when debugging overlapping 
> layouts
> (especially when you didn't design the parent!) - use different 
> backgrounds!

Yes, or for Frames use a relief value to see where the frame bounds are.

> Here's my changes (also found here: http://rafb.net/p/clKroD65.html )

Here is my stripped down version that does what I think you want::

    def body(self, master):
        self.title("Enter Site/Misc. Data")

        # Heading
        fLocationTitle = Frame(master, height=7)
        fLocationTitle.pack()
        Label(fLocationTitle, text="Geographic Location").pack()

        # Latitude and Longitude
        fCoords = Frame(master)
        fCoords.pack()
        Label(fCoords, text='Latitude:').grid(row=0, column=0, padx=5)
        self.lat = Entry(fCoords, width=12)
        self.lat.grid(row=0, column=1, padx=5)

        Label(fCoords, text='Longitude:').grid(row=0, column=2, padx=5 )
        self.long = Entry(fCoords, width=12)
        self.long.grid(row=0, column=3, padx=5)

I removed quirte a lot of the redundant code that was cluttering things
up and moved the frames to beside the widgets that are contained
within them.

HTH,

Alan G.
Back from vacation...

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

j mercedes | 2 Apr 2009 01:59
Picon
Favicon

toggle through a list

Hi, I have problem here...I am writing a program but I am getting stucked at how to solve the mode of a series of numbers...any ideas???following is the program:

def mode(data):
    num=0
    count=0
    mx=0
    mode=0
    for i in data:
        if num!=data[i]:
            num=data[i]
            count=count+1
        else :
            count=count+1
    if count>mx:
        mx=count
        mode=num
    print 'The mode is: ',mode
    

def median(lst):
    x=len(data)
    y=x/2
    print 'The median is: ',data[y]

def getlst():
    num=[]
    while True:
        s=raw_input('please enter a series of number to evaluate')
        if s=='':break
        num.append(eval(s))
    return num

def avg(y):
   sum(y)
   print'the average is: ', sum/len(y)

data=getlst()

median(data)

avg(data)
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Gmane