Oh right, From his email, I got the impression he was getting a list like -
[[abc\rdef\rghi\r]]
On Wed, 23 Mar 2005 00:12:12 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote:
> Liam Clarke wrote:
> > Worse come to worse, you could always do -
> > x = file(myFile, 'r').read()
> > listX = x.split('
Liam Clarke wrote:
Worse come to worse, you could always do -
x = file(myFile, 'r').read()
listX = x.split('\r')
This will leave the \n in the strings. Reading with universal newlines is a
better solution.
Kent
___
Tutor maillist - Tutor@python.org
ht
[EMAIL PROTECTED] wrote:
Does python tutor cover livewires w.s help?
We will try to answer any questions except direct homework questions. Do you have a specific
question or problem?
Kent
___
Tutor maillist - Tutor@python.org
http://mail.python.org/ma
>From the docs -
In addition to the standard fopen() values mode may be 'U' or 'rU'.
If Python is built with universal newline support (the default) the
file is opened as a text file, but lines may be terminated by any of
'\n', the Unix end-of-line convention, '\r', the Macintosh convention
or '
On Tue, 22 Mar 2005 22:59:00 -, Alan Gauld <[EMAIL PROTECTED]> wrote:
> OK, No fancy math here, so thee might be a cleaner way, but here
> is how I'd do it.
>
Yikes.
Thanks for insight and solving it,
Btw, I bought your book a while ago and it was the first that
explained classes to me in a
Tony C wrote:
The list variable is the same object, and contains the sorted list, so
why bother with the complexity of immutable types at all?
* only immutable objects can be dictionary keys
* specifically immutable strings are a performance optimization
A friend recently asked my this didn't modify his original string variable
s1="this is a string"
s1.replace("is a", "is a short")
"this is a short string"
print s1
"this is a string"
After showing him to change it to this
s1 = s1.replace("is a", "is a short")
print s1
"this is a short string"
Unless I'm mistaken .readlines() is supposed to return a list, where
each index is a line from the file that was handed to it. Well I'm
finding that it's putting more than one line of my file into a single
list entry, and separating them with \r. Surely there's a way to have a
one to one correl
OK, No fancy math here, so thee might be a cleaner way, but here
is how I'd do it.
> (Note the patient only has 5mg tabs, which they can split to make
dose
> adjust my 2.5)
OK< so we are dealing with a unit size of 2.5mg. Convert the total
dosage into 2.5mg units. 35mg = 35/2.5 = 14 units
Divide
Does python tutor cover livewires w.s help?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi Lloyd, it's a SQLite database, with only one app connecting, so I'm
not worried about concurrency right here, ( I think SQLite locks when
you connect anyway), but it's always good to get pointers on best
practise.
Thanks to all.
On Tue, 22 Mar 2005 14:10:24 -0500, Lloyd Kvam <[EMAIL PROTECT
gerardo arnaez wrote:
I apologize to the group for the dupes and not cutting the extended
tail of my previous messages
apology accepted. Your penance is to rewrite one of your python programs
in Perl.
(-:
___
Tutor maillist - Tutor@python.org
http://m
D:\Python24>ad-attr.py
Traceback (most recent call last):
File "D:\Python24\ad-attr.py", line 32, in ?
for k, v in ad_dict(user):
ValueError: too many values to unpack
Try this instead ... I think it should help:
for k,v in ad_dict(user).items():
in 2.3 and newer, the preferred function is '
On Tue, 22 Mar 2005 15:47:19 -0600, Christian Wyglendowski
<[EMAIL PROTECTED]> wrote:
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of jeff
> >
> > Hi,
>
> Hey Jeff,
>
> > I'm trying to print out all the attributes of a user account in active
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of jeff
>
> Hi,
Hey Jeff,
> I'm trying to print out all the attributes of a user account in active
> directory. I got a script from:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303348
> /
I apologize to the group for the dupes and not cutting the extended
tail of my previous messages
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
This is a resend, but I change the subject so I can track this better,
please excuse duplicate
-- Forwarded message --
From: gerardo arnaez <[EMAIL PROTECTED]>
Date: Tue, 22 Mar 2005 13:32:23 -0800
Subject: Re: Tutor Digest, Vol 13, Issue 65
To: tutor@python.org
Hello,
Im a newb
Hello,
Im a newbie python user,
love the way it "just makes sense"
but Im also a working doctor and have been thinking about coumadin
and how to dose it.
I am not sure where to ask this, so I am going to ask on this list for
two reasons
1. I intend to use python to prototype it.
2. There must some
-- Forwarded message --
From: gerardo arnaez <[EMAIL PROTECTED]>
Date: Tue, 22 Mar 2005 13:33:04 -0800
Subject: Math Question
To: tutor@python.org
This is a resend, but I change the subject so I can track this better,
please excuse duplicate
-- Forwarded message -
Hi,
I'm trying to print out all the attributes of a user account in active
directory. I got a script from:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303348/index_txt
Now I'd like it to print pretty.
What I have now is:
import win32com,win32com.client
def ad_dict(ldap_path,value_r
Shidai Liu wrote:
On Tue, 22 Mar 2005 15:27:02 -0500, Bill Mill <[EMAIL PROTECTED]> wrote:
zip(K, *L)
[(100, 1, 3), (200, 2, 4)]
Any idea why zip(*L, K) fails?
I believe the *'ed item needs to be the last argument.
___
Tutor maillist - Tutor@python.org
On Mon, 21 Mar 2005 05:57:28 -0500
Kent Johnson <[EMAIL PROTECTED]> wrote:
> Shitiz Bansal wrote:
> > Now this is so basic, i am feeling sheepish asking
> > about it.
> > I am outputting to the terminal, how do i use a print
> > command without making it jump no newline after
> > execution, which
On Tue, 22 Mar 2005 15:27:02 -0500, Bill Mill <[EMAIL PROTECTED]> wrote:
> >>> zip(K, *L)
> [(100, 1, 3), (200, 2, 4)]
Any idea why zip(*L, K) fails?
--
With best wishes!
Shidai
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/lis
Gabriel Farrell wrote:
I've been looking around at various resources such as the Python/XML
Howto[2], some of the articles by Uche Ogbuji[3], and elsewhere, and
frankly I'm a little overwhelmed by the many seemingly overlapping
methods. Which one would the wise tutors recommend for my situation?
I
> well, I would have said "apply(zip, (l1, l2, l3, ...))" but apply has
> been deprecated in 2.3.
Hi Sean,
Sorry for straying away from the original poster's question, but do you
know why apply() is being deprecated? This is new to me! ... ok, I see
some discussion on it:
http://mail.python.
On Tue, 22 Mar 2005 13:30:09 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote:
> C Smith wrote:
> >
> > On Tuesday, Mar 22, 2005, at 05:01 America/Chicago,
> > [EMAIL PROTECTED] wrote:
> >
> >> I met a similar question.
> >> what if one has L = [[1,2],[3,4]], K = [100, 200]
> >> How to 'zip' a List li
Hi,
I'm just starting to get my feet wet with Python. I'm trying to write
a CGI script to create an XML document using input from a web form.
The created document would be a MODS record[1], so I already have a
Schema for it. I think I could make it work if I just feed the input
into a long strin
> Please post the HTML for the form you are submitting and the HTML from a
> View Source on the result.
>
> Kent
Sorry to have bothered the list. I figured out the answer (sort of). I had
parse the HTML code through an XHTML parser which removed all the name=
leaving id= only. That doesn't work wi
> > In the SQL books I've got, they always seem to have an optional
select
> > statement on the end of inserts/updates, and I was thinking maybe I
> > could do it that way also, but I can't figure out a logical way of
> > putting
> >
> > 'select primary_key from foo where primary_key value > every
C Smith wrote:
On Tuesday, Mar 22, 2005, at 05:01 America/Chicago,
[EMAIL PROTECTED] wrote:
I met a similar question.
what if one has L = [[1,2],[3,4]], K = [100, 200]
How to 'zip' a List like [[1,2,100], [3,4,200]]?
I would do something like:
###
for i in range(len(L)):
L[i].append(K[i])
###
O
Hi Gregor,
I had done the same thing. I also noted that assigning (or inserting)
an element into a list is faster than creating a new list:
l.insert(0,2) is faster than l = [2]+l.
###
def sieve (maximum):
if maximum < 2: return []
limit = int(maximum**0.5)
nums = range(1,maximum+
On Tuesday, Mar 22, 2005, at 05:01 America/Chicago,
[EMAIL PROTECTED] wrote:
I met a similar question.
what if one has L = [[1,2],[3,4]], K = [100, 200]
How to 'zip' a List like [[1,2,100], [3,4,200]]?
I would do something like:
###
for i in range(len(L)):
L[i].append(K[i])
###
/c
_
Vicki Stanfield wrote:
I don't see anything in that page that changes what I am doing. I can get
rid of everything that has to do with retrieving data from
cgi-FieldStorage, and the code executes fine although I get a blank page.
I have revised the code somewhat, but the initial problem of
cgi.Fiel
> I haven't done too much web stuff (or much of anything) with python, but
> I looked into your question a bit (researching other's problems may help
> me avoid them =)). A quick search brought up this page which seems to
> have information which may help you.
>
> http://gnosis.cx/publish/programm
I haven't done too much web stuff (or much of anything) with python, but
I looked into your question a bit (researching other's problems may help
me avoid them =)). A quick search brought up this page which seems to
have information which may help you.
http://gnosis.cx/publish/programming/feature
I have recently started doing cgi in Python and have run into a problem. I
have an html form which has various widgets which accept data. I also have
this in that html file:
formdata.py runs but doesn't seem to contain the data from the form. I'm
not sure of the format for the for with regard to
Hi,
I would like to get comments on Pros/Cons of using Visual Python.
On another note, I have created a couple of MS Access databases for my work.
At a recent conference, a lot of people have expressed an interest in using
these as products for their own use. I am looking for ways to code a
Shidai Liu wrote:
On Mon, 21 Mar 2005 22:51:31 -0800, Sean Perry <[EMAIL PROTECTED]> wrote:
arg_list = []
# fill up arg_list
zipped = zip(*arg_list)
I met a similar question.
what if one has L = [[1,2],[3,4]], K = [100, 200]
What do you want to do with these lists?
How to 'zip' a List like [[1,2,10
Terry Johnson wrote:
Hey to the tutors. I am a newbie of course about the only background is
some old qbasic and very little c and perl. I have been wanting to write
my own Web Server Program and when I saw a few times mentioned around
python about it I am starting to check into it. If the is anyo
Liam Clarke wrote:
Hi,
This is a SQL query for the advanced db gurus among you (I'm looking at Kent...)
Uh oh, you're in trouble if you think I'm an "advanced db guru" :-)
After I've run an insert statement, should I get the new primary key
(it's autoincrementing) by using PySQLite's cursor.lastr
On Mon, 21 Mar 2005 22:51:31 -0800, Sean Perry <[EMAIL PROTECTED]> wrote:
> Tony Cappellini wrote:
>
> well, I would have said "apply(zip, (l1, l2, l3, ...))" but apply has
> been deprecated in 2.3.
>
> So how about this?
>
> arg_list = []
> # fill up arg_list
> zipped = zip(*arg_list)
>
I met
Hi,
> I have been wanting to write
> my own Web Server Program and when I saw a few times mentioned around
> python about it I am starting to check into it.
Take a look at the BaseHTTPServer[0] and the SimpleHTTPServer[1], both come
with Python.
[0] http://docs.python.org/lib/lib.html
[1] http:
Hey to the tutors. I am a newbie of course about the only background is
some old qbasic and very little c and perl. I have been wanting to write
my own Web Server Program and when I saw a few times mentioned around
python about it I am starting to check into it. If the is anyone who has
done such
43 matches
Mail list logo