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
prasad rao wrote:
hi
I got it right.
>>> z=[]
>>> for x in range(1000):
if divmod(x,3)[1]==0:z.append(x)
if divmod(x,5)[1]==0:z.append(x)
>>> sum(set(z))
233168
Instead of using the set function you could just use an elif in your for
loop.
>>> z=[]
>>> for x in range(1000):
Marc Tompkins wrote:
By the way, (totally off-topic, of course, my apologies): what do all
y'all call the "@" operator? Here in the States, we call it the
"at-sign", which I find boring; I believe "sleepycat" is a
Scandinavian thing (I picked it up in some long-forgotten article)
Continuing of
bob gailer wrote:
> Robert Childers wrote:
>> I have rewritten my "hypotenuse" program as follows:>>> #This program
>> calculates the width and diagonal of a golden rectangle
> print "Calculate the width and diagonal of a golden rectangle."
>> Calculate the width and diagonal of a golden recta
Norm All wrote:
> I am learning python and so far have done pretty well, until I got to
> the subject of classes which I have been struggling to understand for a
> while. I have not found any easy to understand tutorial on the web or
> looking in some books for a clear step by step example. Woul
> Could someone please explain 'slices' also for dictionaries?
>
> basically, I'd like to know how you would call every 3rd element in a list
> of lists...
>
> My logic says: ThirdElems=List[:][2]
>
What this does is, just assign the 3 value of List to the variable.
look at this way, step by st
- Original Message -
From: "Jim Morcombe" <[EMAIL PROTECTED]>
To:
Sent: Friday, December 14, 2007 2:43 AM
Subject: [Tutor] using quotes in IDLE
A really dumb question...
When typing things into IDLE, how are quotes meant to work?
If I type"
employee.name = "Susan"
then IDLE ignores
Sry about the previous mail.
- Original Message -
I have a print statement in a for loop so I can watch the progress
for line in file(file):
the_line = line.split()
if the_line:
print ("Index = %.2f") %index
Is there a way that only one line will be output and the vari
I have a print statement in a for loop so I can watch the progress
for line in file(file):
the_line = line.split()
if the_line:
print ("Index = %.2f") %index
Is there a way that only one line will be output and the variable is updated
rather than one line for every i