We are in the process of trying to decide between Python 2.7 and 3.2
with a view to making a 5-10 year commitment to the right platform,
and would appreciate some guidance on how best to connect to SQL
databases in 3.2. ceODBC 2.01 provides an ODBC driver for Python 3.2,
does anyone have experience
This is exactly what I want to do - I can then pick up various
elements of the list and turn them into floats, ints, etc. I have not
ever used decode, and will look it up in the docs to better understand
it. I can't thank everyone enough for the generous serving of help and
guidance - I certainly w
Thanks for the guidance - it was indeed an issue with reading in
binary vs. text., and I do now succeed in reading the last line,
except that I now seem unable to split it, as I demonstrate below.
Here's what I get when I read the last line in text mode using 2.7.1
and in binary mode using 3.2 resp
The following function that returns the last line of a file works
perfectly well under Python 2.71. but fails reliably under Python 3.2.
Is this a bug, or am I doing something wrong? Any help would be
greatly appreciated.
import os
def lastLine(filename):
'''
Returns the last line of
There is a problem, and it's a Python 3.2 problem. All the solutions
presented here work perfectly well in Python 2.7.1, and they all fail
at exactly the same point in Python 3.2 - it's the line that tries to
seek from the end. e.g.
f.seek(offset, os.SEEK_END)
I'll register this as a Python bug. T
Thanks for the pointer. Yes, it is a text file, but the mystery runs
deeper: I later found that it works perfectly as written when I run it
from IDLE or the Python shell, but it fails reliably when I run it
from PyScripter 2.4.1 (an open source Python IDE)! So I suspect
there's a PyScripter issue l
I've implementing this method of reading a file from the end, i.e
def seeker(filename):
offset = -10
with open(filename) as f:
while True:
f.seek(offset, os.SEEK_END)
lines = f.readlines()
if len(lines) >= 2:
return lines[-1]
I would like to upload files to a ftp site, but can't seem to get
through our proxy server, which requires authentication. How can one
do this in Python (I use 2.7, but am more than happy to use 3.2 rc2)
Thanks in advance
Thomas Philips
--
http://mail.python.org/mailman/listinfo/python-list
Worked like a charm! Thank you very much.
--
http://mail.python.org/mailman/listinfo/python-list
I’m experiencing a problem with the csv module in Python 3.1.2, and
would greatly appreciate any help anyone can offer me. When writing
csv files in Python 2.6, I open the output file as 'wb' to prevent a
blank line being inserted after every line. Works like a charm. But I
get an error if I do the
I fixed the problem by creating a file call MyPath.pth that has only
one line
H:/Python
and placing it in the C:\Python31\Lib\site-packages directory. So as a
practical matter, my problem is solved. That said, I'm still puzzled
by why Python 3.1 acts up when I set the environment variable
PYTHONPA
I run Python under Windows XP SP3, and for the longest time, I have
installed it on my C: drive under C:\PythonXX (XX = 20, 21., 26),
and maintained all my Python files on our network in a directory
called H:\Python that I point to by creating an environment variable
called PYTHONPATH. I recent
I think a setup guide for the Mac would prove very useful. Earlier
this year, I tried installing Python 2.6 on my iMac, and ran into all
sorts of problems, largely as a result of the fact that I knew very
little about Unix. I finally downloaded and installed the Enthought
Python distribution for th
I taught myself Python from Python Programming for the Absolute
Beginner by Michael Dawson (which has been mentioned above) and with
lots of help from the friendly members of this group, but there's now
a free e-book titled Snake Wrangling for Kids by Jason Briggs. You can
view it at http://www.bri
14 matches
Mail list logo