Re: [Tutor] Using Python with a Mac

2010-02-21 Thread Monte Milanuk
On Sun, Feb 21, 2010 at 10:36 PM, Marco Rompré wrote:

> Hi everyone, I would like to know how to use python with a mac.
>
> For now, I go to spotlight, open terminal then type IDLE and a window pops
> up but its like the window that opens when you run your programs already
> saved and I'm not able to open another window to write a script from
> scratch.
>

By default IDLE seems to open up a python interpreter window (regardless of
platform).  If you hit Apple-N to open a 'New' window, or select the
equivalent command from the menu, it will open a new window for entering a
script; from there you can perform various actions (save, run, debug, etc.)

If you click on 'Python' to the left of 'File' and select 'Preferences' and
then pick the 'General' tab you can opt to have IDLE open up with an editor
window instead of an interpreter window the next time you start.

HTH,

Monte
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] raising number to a power

2010-02-25 Thread Monte Milanuk
Is there a benefit (besides brevity) one way or the other between using:

import math
...
math.pow(x,y)  # x raised to the power y

vs.

x**y

?

Thanks,

Monte
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Extract from file

2010-06-08 Thread Monte Milanuk

On 6/8/10 5:44 PM, Manju wrote:

Hi,

I need help with extracting information from file.

I have a file which is a comma delimited text file containing separate
line for each booking. Each line is composed of date, room number,
course number and course day.


Course day??? Not sure what you meant by that, on top of the already 
mentioned 'date'...?




I need to extract only the room number which is entered at the prompt
and display course number, date and room number.

I have so far managed accept the entry from the prompt, to open the file
and display all the text



This may be a case of the blind leading the blind, but here goes:


Given this data file (comments not included in actual file):

#
#  example.txt
#

# date, room, course
2010-06-08,123,246
2009-06-08,234,468
2008-06-08,345,680


#
#  example.py
#

room = raw_input("Enter the room #:  ")

file = open("example.txt", "r")

for line in file:
line = line.strip()
line = line.split(',')
if line[1] == room:
print "Date:   " + line[0]
print "Room:   " + line[1]
print "Course: " + line[2]
file.close()

>>>
Enter the room #:  234
Date:   2009-06-08
Room:   234
Course: 468
>>>

HTH,

Monte

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Extract from file

2010-06-09 Thread Monte Milanuk
Dave Kuhlman  rexx.com> writes:


> 
> Monte gave you a good suggestion *if* you are sure that there is no
> quoting and, especially, if you are sure that there are no commas
> inside of quotes in your input data.
> 
> However, it seems that you are dealing with a CSV (comma separated
> values) file.  Python has a module for that.  See:
> 
> http://docs.python.org/library/csv.html
> 
> That module might help you write safer code.
> 

Well, like I said... 'blind leading the blind'.  I was piecing it together from
what I've been exposed to.  I had a feeling there was a csv function out there
but not having any experience with it I stuck with what I had seen.  Reading up
on the csv file reading function, it does appear to be a *much* better solution
for reading the file and processing the contents!

Monte

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Handling 'None' (null) values when processing sqlite cursor results

2010-07-13 Thread Monte Milanuk

Hello all,

I'm struggling a bit trying to find the right way to deal with null 
values in my sqlite database when querying it and processing the results 
in python.


If my cursor.fetchall() results return the following:

(104, None, u'Sylvester', None, u'Evans', None, u'527-9210 Proin Av.', 
u'Liberal', u'VT', u'24742', u'1-135-197-1139', 
u'vehicula.pellentes...@idmollis.edu', u'2010-07-13 22:52:50', 
u'2010-07-13 22:52:50')


At first I was having fits as str.join() was giving me a 'NoneType 
error'.  I found one way around that, by processing the results so the 
'None' values got omitted from the list by the time they got to str.join().


I thought that was the end of that, until I tried working with the 
returned records in another fashion and found that having the 'None' 
values omitted really messed with the list order which I was depending 
on i.e. list[5] could be different fields depending on how many 'None' 
values had been omitted.  And if I didn't omit them, when I printed out 
the user name in the format 'first''middle''last' from the above record, 
I got 'Sylvester''None''Evans' rather than just 'Sylvester''Evans' (i.e. 
with no middle initial).


So... I guess my question is, is there a good/proper way to handle the 
'None' values as returned by sqlite from a table that may have some null 
values in individual records?  Basically I want not have the None/Null 
values show up but to keep them as place holders to make sure i get the 
values in the right spots...


TIA,

Monte

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Handling 'None' (null) values when processing sqlite cursorresults

2010-07-14 Thread Monte Milanuk

On 7/14/10 5:32 AM, Alan Gauld wrote:


The key principle is do not try to store your data in a display format.


Never was my intention.  I just hadn't anticipated needing to write my 
own function to handle something as (I would think) common as a NULL 
value in a database field.


I had been working with something very simple like:

for lines in cursor.fetchall()
title = lines[1]
first = lines[2]
mid = lines[3]
last = lines[4]
...

print "%s %s %s %s" % (title, first, mid, last)
print "%s" % (street)
print "%s, %s %s" % (city, state, zipcode)
print "%s" % (phone)
print "%s" % (email)

etc. etc.  for one format (supposed to look like a mailing label, more 
or less), and then I was going to experiment with other formatting later.


I'll work with the stuff you all have provided as I get time... thanks a 
bunch!


Monte

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] clear screen inside python interpreter

2009-08-06 Thread Monte Milanuk
Okay, simple question: is there anything similar to to 'clear' or 'cls' to
clean up a console window full of commands in the python shell?  Short of
exiting and restarting the interpreter I'm not having a lot of luck here.

Thanks,

Monte
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Need help w/ a for loop

2008-10-23 Thread Monte Milanuk
Hello all,

New guy here, so go easy on me ;)

I'm starting to work my way through Python Programming by Zelle, and have hit a 
bit of a wall on one of the programming exercises in Chapter 3 (#15 if anyone 
has the book handy).  

What the question ask is:  Write a program that approimates the value of pi by 
summing the terms of this series: 4/1 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11+...  The 
program should ask the user for 'n', the number of terms to sum, and then 
output the sum of the first 'n' terms of this series.

Where I am running into problems is how to do the '-' & '+', depending on the 
value of 'n'.  i.e. if 'n' = 3, it's going to be a - & an +, if 'n' =5 its 
going to be -, +, -, +, etc.  How to make that work in terms of an algorithm is 
making my head hurt (and its so early in the book yet... ;) )

Here's what I have thus far:

#   approximate_pi.py
#   Approximates the value of 'pi' by summing the terms of a series.
#

import math

def main():
print "This program will approximate the value of pi"
print "to a degree determined by the user. "
print

#  get the value of n from the user
n = input("How many terms do you want me to sum?  ")
print

#  create a loop from 1 to n+1, odd)
for i in range(1,n + 1,2):
#  each term is '4/i' as it steps thru the loop starting with 1
x = 4 / i
#  not sure where to go from here


print
#  output the sum - convert it to a float just in case
print "The sum of the numbers you entered is", (float(sum))

#  calculate the difference between our approximation and Python's pi
diff = sum - math.pi

#  output the difference
print
print "The difference between your 'pi' & Python's pi is", diff, "."



main()


Any assistance or nudges in the right direction would be most appreciated.

Thanks,

Monte
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Need help w/ a for loop

2008-10-24 Thread Monte Milanuk
Hello again, and thanks to all of you who extended your help!

Wayne,

Thanks for your examples.  They did end up helping in with finding a pattern to 
do the odd numbers with.  Maybe I'm not clever enough, but I didn't see how 
either example could be used for doing the addition/subtraction determination.  
Or rather, I found a different way after reading someone else's examples.

Kent,

Thanks for the hint about 'sum', as well as the reminder about float vs. 
integer math.  Whoops!  As far as whether this is homework or not... not in the 
traditional sense.  Yes, the book 'Python Programming' is intended as a 
first-semester comp-sci text, so the questions that I'm working through are 
probably going to seem an awful lot like homework.  For better or worse, 
though, the only person assigning 'homework' or grading anything is me.  I am 
taking some online classes towards an AA degree; sadly, the local community 
college does not offer (or count) any computer classes online (and with my work 
schedule, thats the only way that can work for me).  So yes, I do appreciate 
not being completely spoon-fed as I need to learn this stuff, but no, I'm not 
'cheating' on homework for a class per se.

Bob,

Your post was most helpful, in an indirect sort of way.  The examples didn't 
work directly, or at least they didn't give the right answer (as far as I could 
tell).  In them was the key (at least, the one I used) to get things working.  
The 'x += ...' tidbit was really neat (probably old hat to you) but I couldn't 
find it in the documentation anywhere - I finally broke down and just started 
messing with it in the IDLE shell window.  Slick!

Kent, Richard, etc.

While I imagine there are a wide array of ways to do this, especially using 
more advanced functions or modules... I am trying to work thru this one using 
the basic tools covered up so far in the book - for loops are about as complex 
as has been gone into yet.  As such...  I got to beat my head on the screen for 
a while trying to figure out why some versions did (or didn't) work... 
including making some very dumb mistakes that kept me working on this for 
probably a good half-hour to an hour (off and on) longer than I needed to.  
Aaarrrgh.

Anyway, here's what I worked out.  Let me know what you think I did right, and 
what needs tweaked:

IDLE 2.6  
>>> (4.0/1)-(4.0/3)+(4.0/5)-(4.0/7)+(4.0/9)
3.3396825396825403
>>> (4.0/1)-(4.0/3)+(4.0/5)-(4.0/7)+(4.0/9)-(4.0/11)
2.9760461760461765
>>> (4.0/1)-(4.0/3)+(4.0/5)-(4.0/7)+(4.0/9)-(4.0/11)+(4.0/13)
3.2837384837384844
>>> (4.0/1)-(4.0/3)+(4.0/5)-(4.0/7)+(4.0/9)-(4.0/11)+(4.0/13)-(4.0/15)
3.0170718170718178
>>> 

So using the python shell as a calculator, there are what I work out as the 
right answers for 5, 6, 7, & 8 iterations.  And here is the program that I 
worked out that seems to come up with the right answers:

#   approximate_pi.py
#   Approximates the value of 'pi' by summing the terms of a series.
#

import math

def main():
print "This program will approximate the value of pi"
print "to a degree determined by the user. "
print

#  get the value of 'n' from the user
n = input("How many terms do you want me to sum?  ")
print

#  initialize variables
x = 0
m = 1

#  loop thru n times, summing each pass and switching the sign
#  on m each time, and printing x every time through.
for i in range(n):
x = x + m*(4.0/(i*2+1))
m = -m
print x

#  assigning x to pi
pi = x

print
#  output the sum
print "The sum of the numbers you entered is", pi

#  calculate the difference between our approximation and Python's pi
pi_diff = math.pi - pi

#  output the difference (final portion of the problem in the book)
print
print "The difference between your 'pi' & Python's pi is", pi_diff, "."

main()___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] string.join()

2008-11-03 Thread Monte Milanuk
Hello again,

Just looking for clarification on a point:  the book I'm using is written 
around Python v.2.3, and has an exercise using string.join().  Specifically, it 
said to use string.join(msgList, ""), the object of which was to take the list 
items in msgList and concatenate them using a blank or no character between.  
After some work it did work as advertised, which is all well and good, but I 
hit a bit of a snag along the way.  I *think* I got it figgered out, but would 
like some verification.  

Basically... when I was reading through the documentation trying to decide how 
to re-write an earlier program using string.join() as described above... I 
noticed the docs said that a bunch of  string functions were deprecated and 
going away in Python 3.0.  As such... I thought perhaps since I was in the 
neighborhood so to speak maybe I should learn to do things the 'new' way.  It 
took me a while to get from string.join(words[, sep]) to str.join()... which 
almost immediately puked and didn't work.  After a while longer, I finally 
noticed somewhere that 'str' was supposed to be the string used for the 
separator, so I use ''.join(msgList), which seems to work (or at least give 
identical output) in this case.

So... do I have it correct?  Yes/no/maybe?

Thanks,

Monte
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] string.join()

2008-11-03 Thread Monte Milanuk
Thanks for the verification, folks.

What had me stumped for a while was the first method was 
string.join(words[,sep]), and the new one showed str.join(words)... it wasn't 
immediately obvious (to me) that 'str' was in this case supposed to be the 
separator.

Thanks again,

Monte
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] printing in python 3.x

2010-12-04 Thread Monte Milanuk

Alan,

Perhaps this is a silly question (and possibly not strictly 
python-related) but I was under the impression that controlling exactly 
layout via html was kind of difficult and somewhat fragile.  The latter 
perhaps less so as one could make some fairly concrete assumptions about 
the paper size being used in this situation.  Is it common to use HTML 
for formatting printed reports?!?  Could you give an example of how 
you'd control the layout of specific fields on a printed report?


Thanks,

Monte

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Functional tutorial covering SQL database + GUI interface

2011-11-28 Thread Monte Milanuk
Hello all,

Thought I might ask here just to make sure my Google-fu isn't on the fritz and 
I'm not missing something already existing...

Is there / do you know of any tutorial that covers actually using an SQL 
database with a GUI interface (say, sqlite and tkinter since they come 
packaged with python by default) to build something moderately useful like a 
small address book i.e. CRUD application?  

Seems like most of the tutorials cover isolated 'proof of concept' db access 
or small windows with a button and label, not a lot more.  I'm kind of at that 
point where I think I'm ready to move beyond that to making something a little 
more functional and thought I might see if there were any prior works that 
covered this sort of thing.

TIA,

Monte

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] sqlite3: turning on foreign key support thru python

2011-12-16 Thread Monte Milanuk
I'm setting up an sqlite3 database to use as a base for some programming stuff I
want to work on.  Currently using python 2.7, which appears to have a new enough
version of sqlite (just barely) to support foreign keys.

As I understand things, sqlite by default has foreign keys turned off, unless
specifically compiled otherwise or until you turn on foreign keys using 'pragma
foreign_keys=ON'.  And it needs to be turned on for each connection too.

So... just putzing around using the python interactive shell...


import sqlite3
sqlite3.sqlite_version
'3.6.21'
conn = sqlite3.connect('contacts.db')
conn.execute('pragma foreign_keys=ON')

conn.execute('pragma foreign_keys')



It appears I am able to successfully import sqlite3, its of a recent enough
version to support foreign keys (> 3.6.19), I connected it to an existing
database 'contacts.db', and when I execute the pragma statement to turn on
foreign key support it returns a cursor object.  Similarly, when I send a pragma
statement to query the status of foreign key support, it returns a cursor 
object.

Now for the stupid question(s):  

How do I tell if it succeeded (short of trying an operation that should be
blocked by foreign keys)?  How do I use that cursor object returned by the
pragma query to tell if its a '1' (on) or a '0' (off) and verify the state?

TIA,

Monte

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] sqlite3: turning on foreign key support thru python

2011-12-16 Thread Monte Milanuk
That helped immensely... I was trying some different things trying to get
at the results, but it never occurred to me to try iterating over it.  The
bit about some objects being iterable and some not is good to know!

Thanks,

Monte

On Fri, Dec 16, 2011 at 11:43 AM, Modulok  wrote:

> >> How do I tell if it succeeded (short of trying an operation that should
> be
> >> blocked by foreign keys)?  How do I use that cursor object returned by
> the
> >> pragma query to tell if its a '1' (on) or a '0' (off) and verify the
> state?
>
>
> The cursor object contains the result set. It's a python generator object.
> (Or
> at least a generator interface.) You have to iterate over it in order to
> see
> the resulting rows which are stored as a tuple. Not all operations return a
> result row. (For example, conn.execute('pragma foreign_keys=ON' will
> return a
> cursor object, but it won't generate any result rows, as there were
> none returned by the database.)
>
> To see the result of your second command, do something like this::
>
>rows = conn.execute('pragma foreign_keys')
>for r in rows:
>print r
>
>
> You'll then see something like this when foreign keys are turned on::
>
>(1,)
>
> Or this when they're turned off::
>
>(0,)
>
> Hope that helps.
> -Modulok-
>
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] insert queries into related tables referencing foreign keys using python

2011-12-23 Thread Monte Milanuk
So... most python-sqlite tutorials concentrate on single tables.  The few that
deal with multiple tables and that mention foreign keys and such seem to
demonstrate mainly using hard-coded data instead of parameterized insert queries
into tables with auto-increment primary keys.  For the most part I'm able to
figure things out as I go using a variety of documents both print and
electronic... but when I don't *know* the pk number (because its automatically
assigned) it makes it tough to supply it as a foreign key for another insert
query into related tables.  

Whats the 'right' way to do this sort of record insert or update query?  Insert
into the main table first, then do a select query to find the last rowid and
store it in a python variable and then use that as a parameter for the rest of
the insert queries to related tables?  Pull the value from the seq column of the
sqlite-sequence table for the table with the primary key, and use that (not sure
how robust that would be down the road, or how portable it would be if I later
moved to MySQL for the DB)?  Or is this something an ORM like SQLalchemy would
smooth over for me?  In part I'm (also) wondering if this may be an artificial
problem, as I'm trying to import data from a csv file i.e. one big table and
then break it up and insert it into multiple tables in the sqlite database...

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] insert queries into related tables referencing foreign keys using python

2011-12-24 Thread Monte Milanuk
Lie Ryan  gmail.com> writes:

> In python-sqlite, the rowid of the 
> last insert operation can be queried using cursor.lastrowid. Therefore, 
> you can query the lastrowid, right after the insert, to find the primary 
> key of the value you had just inserted. So, in code:
> 
> ...
> cur = conn.execute('INSERT ... ')
> pk = cur.lastrowid
> ...
> 
> or even:
> 
> ...
> pk = conn.execute('INSERT ... ').lastrowid
> ...
> 
> Be careful that in multithreaded program, each thread should have their 
> own cursors, or otherwise another thread could possibly do another 
> insert before you can query the lastrowid.
> 

okay, this touches on something that had been worrying me a bit... whether
another insert could hit before I queried for the lastrowid, regardless of how I
did it.  So you're saying that as long as I have the one cursor open, the
lastrowid it gets will be the lastrowid from its operations, regardless of other
commits or transactions that may have happened in the meantime?

> 
> In general, despite the superficial similarities, most database engine 
> wrappers have their own ways of doing stuffs. Generally, you need a 
> full-blown ORM to smooth out the differences.
> 

So... what would be considered a 'full-blown' ORM?  SQLobject or SQLalchemy...
or something else?

Thanks,

Monte


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] insert queries into related tables referencing foreign keys using python

2011-12-25 Thread Monte Milanuk

On 12/24/2011 11:13 PM, Lie Ryan wrote:


Querying .lastrowid is pretty much safe as long as you don't use a
single cursor from multiple threads. The .lastrowid attribute belongs to
a cursor, so write operations from one cursor would not affect the
.lastrowid of other cursors.

However, note that multiple cursors created from a single connection
will be able to see each other's changes immediately (as opposed to when
commited). This might or might not always be desirable.

In sqlite, it is more common to create one **connection** for each
thread. Creating one connection for each thread prevents concurrency
problems since each thread will not see uncommitted data from another
thread.

However, the recommended scenario is to avoid multithreading at all.
sqlite developers have a strong opinion against multithreading
(http://www.sqlite.org/faq.html#q6), even though they claimed that
sqlite is the *embedded* SQL engine with the most concurrency (and it
does very well in multithreaded scenarios). It is common pattern in
sqlite-backed applications to have a single thread doing all the writes.



Okay... sounds like I should be safe for the most part.  Down the road 
(way down the road) I had some thoughts of working on an application 
that would in certain situations have multiple users (1-10) and had 
hoped that as long as I kept the sqlite insert/update activity wrapped 
in transactions there wouldn't be much problem with table locks, etc. 
and in this case, confusing lastrowid from one transaction with that 
from another.


By the time I get to where I'm ready/willing/able to write that 
particular app, I might have moved on to an ORM, though.


Thanks,

Monte

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] newbie Questions

2012-07-16 Thread Monte Milanuk
Probably the single biggest 'problem' with Python for web development, in
my opinion, is that while a lot of web hosts have all sorts of PHP
templates or frameworks installed and ready for easy deployment... Python
options seem to be a bit sparser.  Individual hosts may vary, but thats the
overall sense of things that I've gotten

Please note I'm not saying that there are fewer Python options overall, or
that its in any way inferior... just a matter of market penetration.  PHP
has been one of the big dogs in open-source web development for a while,
merits or warts aside.  Python might be arguably 'better' in various ways,
but momentum in the market place is hard to ignore.

I'm guessing your friend 'sees' more PHP out there than Python too, hence
his recommendations.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] CSV -> sqlite tables with foreign keys

2012-10-16 Thread Monte Milanuk
Hello,

I'm working on a python script to take the sql script, create a sqlite3
database, create the tables, and then populate them using the info from the
csv file.
The sticking point seems to be creating the foreign keys between the tables

I've got a data file with lines like this:

"John","G.","Smith","1972-11-10","123 Any
Place","Somewhere","Missouri","58932"

I have an SQL script set up to create the tables with the appropriate
fields.

What I have so far that works is something like this:

try:
data = open(CSV_FILE, 'rb')
reader = csv.reader(data)
for row in reader:
cursor.execute('''INSERT INTO people (first_name, mid_init,
last_name, birth_date)
VALUES (?,?,?,?)''', row[0:4])

person = cursor.lastrowid
address = list(row)
address.append(person)
row = tuple(address)

cursor.execute('''INSERT INTO physical_address (street, city,
state, zip_code,person)
VALUES (?,?,?,?,?)''', row[4:])
finally:
data.close()


It works... but from what I've found on the web, I get the distinct
impression that converting from a tuple to a list and back is considered
poor practice at best and generally to be avoided.

I'm not really sure how else to go about this, though, when I need to split
one row from a CSV file across two (or more) tables in a database, and
maintain some sort of relation between them.

Any suggestions?


Thanks,

Monte
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] CSV -> sqlite tables with foreign keys

2012-10-17 Thread Monte Milanuk
Thanks for the help!  Not sure why I assumed that csv.reader was returning
row as a tuple instead of a list... that makes that part easier ;)

As for the 'INSTEAD OF' trigger on a VIEW... that *does* look pretty
handy.  I was trying to remember why I hadn't heard of that before, or why
I hadn't looked into it.  I think it has to do with MySQL not supporting
triggers on views, at least not 'INSTEAD OF'.  Right now I'm using sqlite,
but at some point I may need to work with MySQL as well.  It's getting kind
of frustrating how many little things it doesn't support...
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] data analysis with python

2012-11-16 Thread Monte Milanuk
Hello David,

I know you said you settled on R... but just in case you are still
interested in possible Python options, I think this book might well cover
about everything you were looking for using numpy, scipy and pandas.

Python for Data Analysis
http://shop.oreilly.com/product/0636920023784.do


Monte
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Re: Clearing Python text

2012-12-14 Thread Monte Milanuk

On 12/14/2012 07:25 AM, Waters, Mike [ITSCA Non-J&J] wrote:

Hi Tutor,

I am using Win 7 ,Python 2.7. Interpreter.

To state my challenge : When I have filled a page with values and text
until it reaches the bottom of the screen, how can I highlight this and
remove to allow further entries? I have seen John Guttag do this but he
seems to be using a MAC.



I'm assuming you're using the interpreter in IDLE?

Try 'Control + L', if memory serves.



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Is this possible for a newbie?

2014-07-20 Thread Monte Milanuk
On 2014-07-21, Steven D'Aprano  wrote:
> On Sun, Jul 20, 2014 at 04:57:24PM -0400, keith papa wrote:
>
>> Am a newbie to programming and I started learning python days ago. I 
>
> This sounds more like something for a database than for Python itself.
>
> You can write Python code to talk to the database, and Python has 
> excellent libraries for a simple database, such as sqlite. 

I'd agree up to this point...

> But if you're on a Linux system and can install Postgres, I'd just use that 
> directly 

But this...?  Why in the name of Pete would you suggest a newbie setup
something like postgresql for something this small/simple?  Yes, sqlite
has its limitations but I don't think the OP is likely to run into them
any time soon on a project like this.

Monte

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Coming from R, what's a good IDE editor? I've tried PyCharm and Spyder

2017-06-08 Thread Monte Milanuk
Have you looked at Rodeo (https://www.yhat.com/products/rodeo)?  The UI 
looks a *lot* like R-Studio (for a reason)...


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor