. class Value:def __init__(self, vs = ""):
>... self.vs = vs
>... self.v = self.asInt()
>...def asInt(self):
>... try: self.v = int(self.vs)
>... except: self.v = None
>... return self.v
>...def asString(self):
>...vs = str(self.vs)
>...
"wormwood_3" wrote
On point 2, say I enter:
Enter text, 'done' on its own line to quit:
I am a sentence. I am another sentence.
I am a new paragraph.
done
What I get out is:
I am a sentence. I am another sentence. I am a new paragraph.
But that just shows the double new lines of my new par
"Andre Engels" wrote
The newline character is written \n in Python, so if you replace
' '.join(user_input)
by
'\n'.join(user_input)
Yep, that's better than my suggestion of adding
the \n at append time. :-)
Alan G.
___
Tutor maillist - Tu
I'm using Python 2.5.4. I wanted to try out the SMTP module. I tried to
send an email through my Gmail account but it keeps saying that the
connection was refused.
This is the code that I used :
import smtplib
msg = 'Test'
server = smtplib.SMTP('smtp.gmail.com')
server.set_debuglevel(1)
serv
On Wed, Jan 7, 2009 at 9:45 AM, prasad rao wrote:
> hello
> Sorry to interject.
> This class seems asymmetric.
> Class Value:
> def __init__(self,inte='',stri=''):
> self.inte=inte
> self.stri=stri
> def setvalue(inte='',stri=''):
> self.stri=str(self.inte)
>
Hello
I am trying to get a value as integer and a string.
>>> class Value:
def __init__(self,inte='',stri=''):
self.inte=inte
self.stri=stri
def setvalue(self,inte='',stri=''):
self.stri=str(self.inte)
self.inte=int(self.stri)
>>> v=Value(45)
>>>
good day
I just started using python and i want to know how can i solve a boundary value
problem for ordinary differential equations using shooting method in python.use
the general equation to demonstrate the python code.
Thank you
--
This message is subject to the CSIR's copyright terms and
On Wed, Jan 7, 2009 at 10:57 AM, prasad rao wrote:
> Hello
> I am trying to get a value as integer and a string.
class Value:
> def __init__(self,inte='',stri=''):
> self.inte=inte
> self.stri=stri
> def setvalue(self,inte='',stri=''):
> self.stri=str(
WM. wrote:
Norman Khine wrote:
>>> i = 5
>>> j = 7
>>> if i <= j:
... print 'nudge', 'nudge'
... else:
... print 'whatever'
...
nudge nudge
>>>
Yes, I understand how your program works. What I do not understand is
how you got it. My program came out in IDLE as you see it. No ..
Kgotlelelo Legodi wrote:
good day
I just started using python and i want to know how can i solve a boundary
value problem for ordinary differential equations using shooting method in
python.use the general equation to demonstrate the python code.
I have no background in numeric calculations,
Marco Petersen wrote:
I'm using Python 2.5.4. I wanted to try out the SMTP module. I tried to
send an email through my Gmail account but it keeps saying that the
connection was refused.
This is the code that I used :
import smtplib
msg = 'Test'
server = smtplib.SMTP('smtp.gmail.com')
server
Hello guys,
I have a linked list where *number of elements is unlimited* and
**last element points on random (can be first, last, in middle ,
anywhere) element within linked list** - this is important . My goals
is to create an architecture /scheme for **algoritmus which will count
total number of
I'm brand new to python and every time i start to learn it i get the same
problem and end up giving up and moving on to another language.
the print statement doesn't work in either the comand line or IDLE i get
this in IDLE:
SyntaxError: invalid syntax (, line 1)
and just SyntaxError: invalid sy
I got a similar problem, except that calling it twice wouldn't work for me. I
tried looking everywhere and I seemed to be doing everything exactly like other
people. After fiddling around, I got this order:
pygame.init()
pygame.display.set_icon(pygame.image.load("image.bmp"))
window
On Wed, Jan 7, 2009 at 5:28 AM, A.T.Hofkamp wrote:
> WM. wrote:
>>
>> Norman Khine wrote:
>>>
>>> >>> i = 5
>>> >>> j = 7
>>> >>> if i <= j:
>>> ... print 'nudge', 'nudge'
>>> ... else:
>>> ... print 'whatever'
>>> ...
>>> nudge nudge
>>> >>>
>
>> Yes, I understand how your program wor
good day
I just started using python and i want to know how can i solve a boundary value
problem for ordinary differential equations using shooting method in python.use
the general equation to demonstrate the python code.
Thank you
Kgotlelelo Legodi
Natural Resources and the Environment
CSIR
0
David Hláčik wrote:
Hello guys,
I have a linked list where *number of elements is unlimited* and
**last element points on random (can be first, last, in middle ,
anywhere) element within linked list** - this is important . My goals
is to create an architecture /scheme for **algoritmus which will
On Wed, Jan 7, 2009 at 7:06 AM, mickth wrote:
>
> I'm brand new to python and every time i start to learn it i get the same
> problem and end up giving up and moving on to another language.
>
> the print statement doesn't work in either the comand line or IDLE i get
> this in IDLE:
> SyntaxError:
On Wed, Jan 7, 2009 at 4:46 AM, Kgotlelelo Legodi wrote:
> good day
>
> I just started using python and i want to know how can i solve a boundary
> value problem for ordinary differential equations using shooting method in
> python.use the general equation to demonstrate the python code.
Googli
On Tue, Jan 6, 2009 at 4:45 AM, Marco Petersen
wrote:
> I'm using Python 2.5.4. I wanted to try out the SMTP module. I tried to send
> an email through my Gmail account but it keeps saying that the connection
> was refused.
>
> This is the code that I used :
>
> import smtplib
> msg = 'Test'
>
>
>
Kent Johnson wrote:
On Wed, Jan 7, 2009 at 5:28 AM, A.T.Hofkamp wrote:
WM. wrote:
Norman Khine wrote:
>>> i = 5
>>> j = 7
>>> if i <= j:
... print 'nudge', 'nudge'
... else:
... print 'whatever'
...
nudge nudge
>>>
Yes, I understand how your program works. What I do not understa
On Wed, Jan 7, 2009 at 5:59 AM, David Hláčik wrote:
> Hello guys,
>
> I have a linked list where *number of elements is unlimited* and
> **last element points on random (can be first, last, in middle ,
> anywhere) element within linked list** - this is important . My goals
> is to create an archit
On Wed, Jan 7, 2009 at 1:06 AM, mickth wrote:
>
> I'm brand new to python and every time i start to learn it i get the same
> problem and end up giving up and moving on to another language.
>
> the print statement doesn't work in either the comand line or IDLE i get
> this in IDLE:
> SyntaxError:
Joining with newline works perfectly.
Thanks everyone!
___
Samuel Huckins
Homepage - http://samuelhuckins.com
Tech blog - http://dancingpenguinsoflight.com/
Photos - http://www.flickr.com/photos/samuelhuckins/
AIM - samushack | Gtalk - samushack | Skype - shuckins
Marco Petersen wrote:
I'm using Python 2.5.4. I wanted to try out the SMTP module. I tried to
send an email through my Gmail account but it keeps saying that the
connection was refused.
This is the code that I used :
import smtplib
msg = 'Test'
server = smtplib.SMTP('smtp.gmail.com')
server
Hi All,
I am very new to tkSnack. Trying to understand it. Please help me out.
I thought of a very simple scenario. I would like to play a audio from line-in
and then check if the audio is present. If there is no audio for 20 seconds
then i need to raise an error. Is it possible to do this wi
On 1/6/09, Marco Petersen wrote:
> I'm using Python 2.5.4. I wanted to try out the SMTP module. I tried to send
> an email through my Gmail account but it keeps saying that the connection
> was refused.
I used this example to get emailing from python through gmail smtp to work:
http://codecommen
On Wed, 07 Jan 2009 15:47:25 +0100
Ole Henning Jensen wrote:
> Marco Petersen wrote:
> > I'm using Python 2.5.4. I wanted to try out the SMTP module. I
> > tried to send an email through my Gmail account but it keeps saying
> > that the connection was refused.
> > error: (10061, 'Connection refu
I am looking for a function in python that would operate similar to df. I
would use df, but I am unable to parse the data that it gives me from
there. If it would give me a single line I could then split it out if I
needed to, but I can't see how to actually do that. What I am trying to do
is ge
IDLE 2.6
>>> i = 1
>>> j = 11
>>> if j > 1:
print j
else:
SyntaxError: invalid syntax
>>>
I am getting a little dizzy here.
I know about text editor, code, save, F5.
Many tutorials say that it is funner and faster to test an idea
'interactively', using IDLE.
On Wed, Jan 7, 2009 at 4:35 AM, A.T.Hofkamp wrote:
> Kgotlelelo Legodi wrote:
>>
>> good day
>>
>> I just started using python and i want to know how can i solve a boundary
>
> value problem for ordinary differential equations using shooting method in
> python.use the general equation to demonstra
On Wed, Jan 7, 2009 at 11:46 AM, WM. wrote:
> IDLE 2.6
i = 1
j = 11
if j > 1:
>print j
>else:
>
> SyntaxError: invalid syntax
>
> I am getting a little dizzy here.
>
> I know about text editor, code, save, F5.
>
> Many tutorials say that it is funner and faster
--- On Wed, 1/7/09, WM. wrote:
From: WM.
Subject: Re: [Tutor] Interactive programming.
To: "A.T.Hofkamp"
Cc: tutor@python.org
Date: Wednesday, January 7, 2009, 11:46 AM
IDLE 2.6
>>> i = 1
>>> j = 11
>>> if j > 1:
print j
else:
SyntaxError: invalid syntax
>>>
I am getting
Is there anyway to get rid of the header information? I just want the
output that it gives me for the device.
On Wed, Jan 7, 2009 at 11:02 AM, Stuart Sears wrote:
> On 07/01/09 16:42, Spencer Parker wrote:
>
>> I am looking for a function in python that would operate similar to df.
>> I would
On Wed, Jan 7, 2009 at 1:08 PM, Spencer Parker wrote:
> Is there anyway to get rid of the header information? I just want the
> output that it gives me for the device.
If you know how to get the output of df into Python (e.g. with the
subprocess module or a pipe) then you can use the str.splitli
What I did was just grep for anything starting with "/"
It then just outputs it to a single line now...and I can split it as
needed. Thanks again!!1
On Wed, Jan 7, 2009 at 11:33 AM, Kent Johnson wrote:
> On Wed, Jan 7, 2009 at 1:08 PM, Spencer Parker
> wrote:
> > Is there anyway to get rid of
Redirecting to the list as I seem to have replied off-list rather
inadvertently... headers...>
On 07/01/09 16:42, Spencer Parker wrote:
I am looking for a function in python that would operate similar to df.
I would use df, but I am unable to parse the data that it gives me
from there. If it
On 07/01/09 18:08, Spencer Parker wrote:
Is there anyway to get rid of the header information? I just want
the output that it gives me for the device.
parse the output and junk the first line?
I'm no subprocess expert, but a bit of playing about suggests this would
work:
from subprocess impo
Spencer Parker schreef:
> I am looking for a function in python that would operate similar to df.
> I would use df, but I am unable to parse the data that it gives me from
> there. If it would give me a single line I could then split it out if I
> needed to, but I can't see how to actually do tha
Hi there...I'm new to Python scripting, with maybe 3 days under my belt thus
far. Besides the occasional shell script, the last time I ever touched a
programming language was probably at least 12 years ago, if that gives you
any indication of my experience. :)
I don't know if this is the proper pl
Norman Khine wrote:
>>> i = 5
>>> j = 7
>>> if i <= j:
... print 'nudge', 'nudge'
... else:
... print 'whatever'
...
nudge nudge
The above is just what the tutorials said would happen.
Can anyone give me a step-by-step in IDLE 2.6 that would make this happen?
__
On Wed, Jan 7, 2009 at 22:04, Kayvan Sarikhani wrote:
> #!/usr/bin/python
> import os, sys
> sys.stdout = open('timecheck.txt','w')
> for servername in os.listdir('/opsw/Server/@'):
> print '---', servername
> os.system('rosh -n $SERVER_NAME -l $LOGNAME')
> os.system('date')
> sys.stdo
Hi,
so okay, i will create a helping set, where i will be adding elements
ID, when element ID will be allready in my helping set i will stop and
count number of elements in helping set. This is how long my cycled
linked list is.
But what if i have another condition , and that is *i can use only
h
On Wed, Jan 7, 2009 at 22:45, WM. wrote:
> Norman Khine wrote:
>>
>> >>> i = 5
>> >>> j = 7
>> >>> if i <= j:
>> ... print 'nudge', 'nudge'
>> ... else:
>> ... print 'whatever'
>> ...
>> nudge nudge
>
> The above is just what the tutorials said would happen.
> Can anyone give me a step-
IDLE 2.6
>>> i = 1
>>> if i > 1:
print 'x'
else:
print 'y'
y
>>>
Last post on this topic, I guess.
I think that the script looks pretty lame, though.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinf
On Wed, Jan 7, 2009 at 4:45 PM, WM. wrote:
> Norman Khine wrote:
>>
>> >>> i = 5
>> >>> j = 7
>> >>> if i <= j:
>> ... print 'nudge', 'nudge'
>> ... else:
>> ... print 'whatever'
>> ...
>> nudge nudge
>
> The above is just what the tutorials said would happen.
> Can anyone give me a ste
On Wed, Jan 7, 2009 at 5:36 PM, WM. wrote:
> IDLE 2.6
i = 1
if i > 1:
>print 'x'
> else:
>print 'y'
>
>
> y
> Last post on this topic, I guess.
> I think that the script looks pretty lame, though.
It was always lame :-) but you got it to work...
Kent
__
On Wed, Jan 7, 2009 at 4:57 PM, spir wrote:
> Le Wed, 7 Jan 2009 16:04:28 -0500,
> "Kayvan Sarikhani" a écrit :
>
> > #!/bin/bash
> > #
> > # This script checks the dates on all managed systems.
> > OUTFILE="/home/ksarikhani/public/bin/timecheck.txt"
> > rm -f $OUTFILE
> > cd "/opsw/Server/@/"
>
On Wed, Jan 7, 2009 at 5:09 PM, Sander Sweers wrote:
> On Wed, Jan 7, 2009 at 22:04, Kayvan Sarikhani
> wrote:
> >
> > This is of course not a Python error, but as you might guess from looking
> at
> > the script, the whole $SERVER_NAME piece is probably wrong.
>
> Indeed the variables are wrong
Don't try to make interactive programming something its not. It's handy if you
have something short to try out, want to evaluate a function at some value
etc. Don't rage at the hammer for not being an allen wrench get an allen
wrench.
--- On Wed, 1/7/09, Kent Johnson wrote:
From: Kent
Hi everyone - I was playing with subprocess (with some success, I
might add) to implement threading in my script (audio conversion). My
goal is to be able to spawn off threads to make use of my
multiprocessor system (and speed up encoding). With your help, I was
successful.
Anyhow, subprocess is
Terry Reedy wrote:
David Hláčik wrote:
But what if i have another condition , and that is *i can use only
helping memory with constant size* ? This means i am not able to
create any set and adding elements there. I need to have a constant
size variables . This is complication a complication for
> Anyhow, subprocess is working -- but I wonder if there is a way I can
> send the entire *function* into its own subprocess ?
this has been a highly-desired feature for quite awhile.
starting in 2.6, you can use the new multiprocessing module
(originally called pyprocessing):
http://docs.python
On Wed, Jan 7, 2009 at 7:36 PM, wesley chun wrote:
> this has been a highly-desired feature for quite awhile.
>
> starting in 2.6, you can use the new multiprocessing module
> (originally called pyprocessing):
> http://docs.python.org/library/multiprocessing.html
>
> there is a backport to 2.4 and
"Edwin Boyette" wrote
Don't try to make interactive programming something its not.
It's handy if you have something short to try out, want to
evaluate a function at some value etc.
Don't rage at the hammer for not being an allen wrench
But in this case it is a valid complaint. Almost every
"Kayvan Sarikhani" wrote
For the record, $LOGNAME works fine as a variable...it's a standard
env
variable in Linux to display the current user's username.
In that case os.getenv('LOGNAME') should retrieve it for you
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.al
Hello,
I used python list comprehension to create a grid (list of lists) of
Objects (instances of MyItem class). Can anyone make recommendations to
achieve a simple access to the elements. My attempt at array access
(like this: array[1,2] ) does not work. What am I overlooking? Thanks in
advance!
On Wed, 2009-01-07 at 18:12 -0800, Artie Ziff wrote:
> Hello,
>
> I used python list comprehension to create a grid (list of lists) of
> Objects (instances of MyItem class). Can anyone make recommendations to
> achieve a simple access to the elements. My attempt at array access
> (like this: array
> My attempt at array access (like this: array[1,2] ) does not work. What am
> I overlooking? Thanks in advance! :)
> :
> pprint (grid.data[1,2])
is that really your name?!? you're famous! ;-) welcome to python!
i'd try...
pprint(grid.data[0][1])
... as many languages start counting at 0
How can you make a function accept a variable number of inputs without
any particular limit?
Like when you define a function you usually go:
def func(a,b,c,d,e)
and if you want to give a default value for e you can use e=0 for example.
But what if you want to be able to call the function and pu
Mr Gerard Kelly wrote:
How can you make a function accept a variable number of inputs without
any particular limit?
Like when you define a function you usually go:
def func(a,b,c,d,e)
and if you want to give a default value for e you can use e=0 for example.
But what if you want to be able to
On Wed, Jan 7, 2009 at 7:01 PM, bob gailer wrote:
> Mr Gerard Kelly wrote:
>>
>> How can you make a function accept a variable number of inputs without
>> any particular limit?
>>:
>> But what if you want to be able to call the function and put in as many
>> arguments as you want.
>
> def
--- On Wed, 1/7/09, Artie Ziff wrote:
From: Artie Ziff
Subject: [Tutor] simple array access
To: Tutor@python.org
Date: Wednesday, January 7, 2009, 9:12 PM
Hello,
I used python list comprehension to create a grid (list of lists) of
Objects (instances of MyItem class). Can anyone make recomm
63 matches
Mail list logo