[Tutor] mysqlite

2013-03-06 Thread Lolo Lolo
im working through alan's sql tutorial. i have a few questions from there but 1st i wanted to try out an example in Core python's sql example. import sqlite3 cxn = sqlite3.connect('sqlite_test/test') cur = cxn.cursor() after this i created a table called users and inserted some data. then i

Re: [Tutor] Fwd: findall() returns tuples or string?

2013-03-06 Thread Albert-Jan Roskam
I have some confusion regarding when findall returns a list of strings and when it returns a list of tuples. Would appreciate an explanation. re is not my strongest suite but I'll have a go. My understanding of how findall works is that it returns a list of matches. If groups are used in

Re: [Tutor] mysqlite

2013-03-06 Thread Joel Goldstick
On Wed, Mar 6, 2013 at 1:50 PM, Lolo Lolo losermelo...@yahoo.com wrote: im working through alan's sql tutorial. i have a few questions from there but 1st i wanted to try out an example in Core python's sql example. import sqlite3 cxn = sqlite3.connect('sqlite_test/test') cur =

Re: [Tutor] mysqlite :p:

2013-03-06 Thread Paradox
On 03/07/2013 02:50 AM, Lolo Lolo wrote: im working through alan's sql tutorial. i have a few questions from there but 1st i wanted to try out an example in Core python's sql example. import sqlite3 cxn = sqlite3.connect('sqlite_test/test') cur = cxn.cursor() after this i created a table

Re: [Tutor] mysqlite

2013-03-06 Thread Jim Byrnes
On 03/06/2013 03:47 PM, Joel Goldstick wrote: On Wed, Mar 6, 2013 at 1:50 PM, Lolo Lolo losermelo...@yahoo.com wrote: im working through alan's sql tutorial. i have a few questions from there but 1st i wanted to try out an example in Core python's sql example. import sqlite3 cxn =

Re: [Tutor] mysqlite

2013-03-06 Thread bob gailer
On 3/6/2013 1:50 PM, Lolo Lolo wrote: im working through alan's sql tutorial. i have a few questions from there but 1st i wanted to try out an example in Core python's sql example. import sqlite3 cxn = sqlite3.connect('sqlite_test/test') cur = cxn.cursor() after this i created a table called

Re: [Tutor] mysqlite

2013-03-06 Thread Lolo Lolo
You are missing cur.execute('SELECT * from users') thanks:) this has fixed the 1st issue.    guys i still cant use the command line. but i guess i dont really mind as i can just make a .py file... i am having a lot of fun reading through alan's tutorial, everything is becoming very clear

Re: [Tutor] mysqlite

2013-03-06 Thread Alan Gauld
On 06/03/13 18:50, Lolo Lolo wrote: i then closed this interactive IDLE session. i reopened another session and simply did import sqlite3 cxn = sqlite3.connect('sqlite_test/test') This gets you a connection to the data base cur = cxn.cursor() and this sets up a storage area for any

Re: [Tutor] mysqlite

2013-03-06 Thread Alan Gauld
On 06/03/13 23:25, Lolo Lolo wrote: can someone please explain this to me. update Employee set ManagerID = (Select EmpID from Employee where Name = 'John Brown') where Name = 'Fred Smith' OR Name = 'Anne Jones'; this is saying set the managerID of 'Fred Smith' or

Re: [Tutor] mysqlite

2013-03-06 Thread Lolo Lolo
I'm not running it from Python I'm running it from the OS command line. You need to open a CMD shell window and cd to your SQL database folder (E:\PROJECTS\SQL in the example above) and then run sqlite3. thanks ill give this a try.   We can logically split it like this   and putting them

Re: [Tutor] A CSV field is a list of integers - how to read it as such?

2013-03-06 Thread DoanVietTrungAtGmail
Once a csv file has been read by a csv reader (such as DictReader), it's no longer a csv file. That was an Aha! moment for me. The file is on disk, each row of it is in memory as a list or dict, and it's the list or dict that matters. It's so obvious now. Thanks Dave. a namedtuple is

Re: [Tutor] A CSV field is a list of integers - how to read it as such?

2013-03-06 Thread Dave Angel
On 03/06/2013 09:05 PM, DoanVietTrungAtGmail wrote: Once a csv file has been read by a csv reader (such as DictReader), it's no longer a csv file. That was an Aha! moment for me. The file is on disk, each row of it is in memory as a list or dict, and it's the list or dict that matters. It's

Re: [Tutor] Fwd: findall() returns tuples or string?

2013-03-06 Thread suhas bhairav
Hi Alan, As far as my understanding goes, re.findall without using () inside your pattern will return you a list of strings when you search something similar to the one shown below: a=Bangalore, Indiare.findall([\w][\n]*,a) Output:- ['B','a','n','g','a','l','o','r','e','I','n','d','i','a'] So

Re: [Tutor] Fwd: findall() returns tuples or string?

2013-03-06 Thread eryksun
On Thu, Mar 7, 2013 at 12:26 AM, suhas bhairav suhasbhai...@hotmail.com wrote: As far as my understanding goes, re.findall without using () inside your pattern will return you a list of strings when you search something similar to the one shown below: a=Bangalore, India