Hi.
I use the following to send through gmail.
message = headers + text
mailserver = smtplib.SMTP('smtp.gmail.com')
if debug == 1: mailserver.set_debuglevel(1)
mailserver.ehlo()
mailserver.starttls()
mailserver.ehlo()
#Define username / password
Hello Samuel,
When sending through smtp.gmail.com you might need to starttls() and
do a login() before sending.
>>> import smtplib
>>> headers = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" %(from,to,subject)
>>> message = headers + "Hello, How are you?"
>>> mailserver = smtplib.SMTP('smtp.gmail.c
Hello,
I am new to Python and as a first project decided to try to parse an XML
report using Python. I have the following, which works to extract one
element. I am stuck, however, at one element. I want to extract several
differenct elements per line, creating a comma separated variable (CSV)
l
Hi Tutors,
How can I extract a specific sublist (??) from a nested list, for example,
if I want to extract the sublist ["ADJ", "good"], or the bigger sublist
["NP",["DET", "The"],["ADJ", "good"],["NOUN", "man"]] from the following
nested list?
nested_list = ["S",["NP",["DET", "The"],["ADJ", "good"
Sander Sweers wrote:
2009/3/10 Alan Gauld :
newFile.write(zf.read(zfilename))
Remember you are reading the file into memory and then writing it
out again in a single operation, that will use twice the space of the
uncompressed files - plus some extra for overhead.
Question, Do you m
"Sander Sweers" wrote
out again in a single operation, that will use twice the space of
the
uncompressed files - plus some extra for overhead.
Question, Do you mean the file in the zipfile (zfilename) or the
whole
zipfile (zf)? I would expect zf.read(zfilename) to only read the
requested
2009/3/10 Alan Gauld :
>> newFile.write(zf.read(zfilename))
>
> Remember you are reading the file into memory and then writing it
> out again in a single operation, that will use twice the space of the
> uncompressed files - plus some extra for overhead.
Question, Do you mean the file in
"Harris, Sarah L" wrote
However I still have a memory error when I try to run it on three
or more files that are over 100 MB?
And this surprises you? :-)
How much memory do you have free on your computer when you run this?
newFile.write(zf.read(zfilename))
Remember you are re
"A.T.Hofkamp" wrote
If you reverse the computation, it gets even simpler:
binstr = raw_input("Please enter a binary number: ")
decnum = 0
for i in binstr:
decnum = decnum * 2 + int(i)
But if we are allowed to use int() it is easier still:
decnum = int(raw_input("Please enter a binar
Finished. Closed. Done. It needed the second line here:
entry =
Entry(master, width=10, textvariable=self.anumberVar)
entry.grid(row=0, column=1)
Wayne Watson wrote:
On a branch off this thread, I've mentioned a problem with this
approach. It seems right, but I haven't
On Tue, Mar 10, 2009 at 8:45 AM, Harris, Sarah L
wrote:
> That looks better, thank you.
> However I still have a memory error when I try to run it on three or more
> files that are over 100 MB?
How big are files in the zip file?
It seems that in this line
newFile.write(zf.read(zfilename))
the
Hello,
Chris Castillo wrote:
Thanks for clearing that up. I knew it was much simpler than I was trying to
make it I just couldn't quite see the logic that I needed for the problem
clearly. Thanks for the elegant code.
On Mon, Mar 9, 2009 at 10:53 PM, Moos Heintzen wrote:
binnum = raw_input("
Thanks for clearing that up. I knew it was much simpler than I was trying to
make it I just couldn't quite see the logic that I needed for the problem
clearly. Thanks for the elegant code.
On Mon, Mar 9, 2009 at 10:53 PM, Moos Heintzen wrote:
> You're making it more complicated than it needs to.
That looks better, thank you.
However I still have a memory error when I try to run it on three or more files
that are over 100 MB?
import zipfile, glob, os
from os.path import isfile
zipnames=filter(isfile, glob.glob('*.zip'))
for zipname in zipnames:
zf=zipfile.ZipFile(zipname, 'r')
Thank you all. It was not easy to decide what to learn/use, so I "Google"
some more.
I have found that PyQT is more stable, faster, more consistent and more
expensive :).
400 € is too much for playing around with some GUI, but GPL licence resolves
that issue.
The cons are C++ oriented documentatio
"Harris, Sarah L" wrote
fname=filter(isfile, glob.glob('*.zip'))
for fname in fname:
This will confuse things. fname starts off as a list of files
and then becomes a single filename inside the loop.
It's never a good idea to duplicate variable names
like that. It also means that after th
David wrote:
This program generates a report of a Linux System and some important
..conf files. The goal is for users to be able to post their information
and compare with others, ask for help etc. Am I using the subrocess
module too much because I am comfortable with the commands? Should I
ju
Hi, Can anybody tell me how to send an email to a recipient using PythonI am
trying to send an email using GmailI create an instance of smtplib and use
:x=smtplib.SMTP(sever,port) and then x.login(user,pwd)I try to send the email
usingx..sendmail(SENDER, RECIPIENTS, msg)But I get the following
18 matches
Mail list logo