Re: [Tutor] Sound question

2011-04-08 Thread Emmanuel Ruellan
On Fri, Apr 8, 2011 at 10:54 AM, Jan Erik Moström wrote: > > > A couple of my students need to be able to play sounds, controlling start & > stop, play sound from files and if possible generate sinus wave sounds. > I've used Snack to generate sounds on both Windows and Linux. http://www.speech.k

Re: [Tutor] Need some clarification on this

2011-03-19 Thread Emmanuel Ruellan
n stranger: >>> a = 10**10 >>> b = 10**10 >>> a == b True >>> a is b False >>> a = 5 >>> b = 5 >>> a == b True >>> a is b True In the general case, you're right: a and b point to two different

Re: [Tutor] Alternatives to pymssql to work with MS SQL Server

2011-03-02 Thread Emmanuel Ruellan
Tim, it's raw SQL queries I want to use. Pyodbc looks fine, thanks for suggesting it to me. I'll have to test it on the specific machine on which I encountered the problem with pymssql. Raúl, thanks for the link to a list of alternatives to pymssql. You suggested that I try and change the order of

[Tutor] Alternatives to pymssql to work with MS SQL Server

2011-03-02 Thread Emmanuel Ruellan
queries on an MS SQL Server database. Best regards, Emmanuel Ruellan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] What does "TypeError: 'int' object is not iterable" mean?

2010-10-21 Thread Emmanuel Ruellan
On Thu, Oct 21, 2010 at 2:42 PM, Richard D. Moores wrote: Traceback (most recent call last): File "c:\P26Working\test_urllib2_ > > 21a.py", line 148, in >unchanged_count, higher_count, lower_count, secs = > sleep_seconds_control(unchanged_count, higher_count, lower_count, > secs) > TypeErro

Re: [Tutor] Problem with python

2010-10-19 Thread Emmanuel Ruellan
On Tue, Oct 19, 2010 at 11:02 PM, Matthew Nunes wrote: > > It wrote a piece of code for the factorial function in math for example 3! > is 3 * 2 * 1. I cannot understand the how it claimed the code executed, and > logically it makes no sense to me. > > I suggest you follow the algorithm yourself,

Re: [Tutor] pymssql and encoding

2010-10-07 Thread Emmanuel Ruellan
Perfect! Thanks Evert. I realise now that I don't fully grasp the concepts of encoding and collation and their relationship. -- Emmanuel On Wed, Oct 6, 2010 at 10:38 PM, Evert Rol wrote: > > > > >>> print customerName > > ImmobiliŠre (whatever) > > >>> customerName > > 'Immobili\x8are (whate

[Tutor] pymssql and encoding

2010-10-06 Thread Emmanuel Ruellan
Hi tutors, I'm trying to fetch data from an MS SQL Server database with pymssql, but non-ascii results get garbled. >>> import pymssql >>> conn = pymssql.connect(user='sa', password=myPassword, host=server, database=targetDatabase, as_dict=True) >>> curs = conn.cursor() >>> curs.execute("select C

Re: [Tutor] Printing prime numbers

2010-09-30 Thread Emmanuel Ruellan
On Thu, Sep 30, 2010 at 1:57 PM, wrote: > > 1 is prime > One is /not/ prime. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] language aid (various)

2010-02-06 Thread Emmanuel Ruellan
On Fri, Feb 5, 2010 at 12:29 PM, Owain Clarke wrote: > > > Seems to be a bit of a consensus here about dictionaries. Let me just > restate my reluctance, using examples from Spanish. > > esperar = to hope > esperar = to wait > tambien = too [i.e. also] > demasiado = too [i.e. excessive] > > So

Re: [Tutor] using re to match text and extract info

2009-12-31 Thread Emmanuel Ruellan
What's wrong with the phone number? >>> phoneNumber.search(line).groups() ('03', '88', '23', '05', '66') This looks fine to me. Here is a regex that splits the line into several named groups. Test it with other strings, though >>> line = "ALSACE 67000 Strasbourg 24 rue de la Division Leclerc 03

Re: [Tutor] Unexpected Result in Test Sequence

2009-11-16 Thread Emmanuel Ruellan
In your code, list list1 never gets emptied. There is another problem : the doc for random.randrange() says it "choose[s] a random item from range(start, stop[, step])" and range(1, 19) goes from 1 included to 19 _not_ included. Your 'd20' is not a 20-sided dice. On Mon, Nov 16, 2009 at 8:18 PM,

Re: [Tutor] SQLite database not update correctly

2009-11-08 Thread Emmanuel Ruellan
It's working fine now, but actually I didn't write exactly what you suggested. The "commit" method belongs to the connection, not to the cursor. Therefore, in my script it should be conn.commit(). On Sun, Nov 8, 2009 at 9:15 PM, Che M wrote: > > > I've got a functions that should update an sqlit

Re: [Tutor] SQLite database not update correctly

2009-11-08 Thread Emmanuel Ruellan
Thanks a lot, Che! It's working fine now. On Sun, Nov 8, 2009 at 9:13 PM, Che M wrote: > > I've got a functions that should update an sqlite database, among other > things. However > > the database doesn't get updated. When used in isolation, the update > statement works > > fine. What am I d

[Tutor] SQLite database not update correctly

2009-11-08 Thread Emmanuel Ruellan
Hi tutors, I've got a functions that should update an sqlite database, among other things. However the database doesn't get updated. When used in isolation, the update statement works fine. What am I doing wrong? Below is the function. The whole script can be found at http://pastebin.com/m53978f

Re: [Tutor] "if clause" in list comprehensions.

2009-10-19 Thread Emmanuel Ruellan
On Mon, Oct 19, 2009 at 9:20 PM, Alan Gauld wrote: > > > "Sander Sweers" wrote > > mylist = ['John', 'Canada', 25, 32, 'right'] >>> a = [item.upper() for item in mylist if type(item) == type('good')] >>> >> >> Usually it is recommended to use hasattr() instead of type() >> hasattr(s, 'upper')

Re: [Tutor] Picking up citations

2009-02-08 Thread Emmanuel Ruellan
Dinesh B Vadhia wrote: > Hi! I want to process text that contains citations, in this case in legal > documents, and pull-out each individual citation. Here is my stab at it, using regular expressions. Any comments welcome. I had to use two regexes, one to find all citations, and the other one

Re: [Tutor] Tutor Digest, Vol 59, Issue 16

2009-01-04 Thread Emmanuel Ruellan
Gerard Kelly wrote: > Hi everyone, I'm a python noob but I have an ambitious (for me) goal: I > want to make a simple program that allows you to hear combinations of > notes according to a vector of frequencies. > > Does anybody know any module that allows you to input a frequency in Hz > and retur

[Tutor] Regular expression oddity

2008-11-22 Thread Emmanuel Ruellan
Hi tutors! While trying to write a regular expression that would split a string the way I want, I noticed a behaviour I didn't expect. >>> re.findall('.?', 'some text') ['s', 'o', 'm', 'e', ' ', 't', 'e', 'x', 't', ''] Where does the last string, the empty one, come from? I find this behaviour r

[Tutor] Unicode and fonts in Idle and Tkinter

2008-06-12 Thread Emmanuel Ruellan
ot better than with Times... Can you advise on a font that works well for Unicode (more specifically, IPA symbols) with Tkinter? preferably on both Windows and Linux. BTW, how come I do not have the same set of fonts available for Idle and for the shell? I'm using Ubuntu (Hardy). My locale is