Re: [Tutor] Coursera Python Course starts today

2013-08-21 Thread Nick Raptis
On 20/08/13 03:02, Leam Hall wrote: https://class.coursera.org/programming1-002/class/index Leam Leam, your link for some reason redirects on a default coursera page, probably cause I'm not enlisted. I think a better link for the course would be https://www.coursera.org/course/programming1

Re: [Tutor] short url processor

2011-05-13 Thread Nick Raptis
On 05/14/2011 03:49 AM, ian douglas wrote: for i in giant_list: if i[0]: if i[1]: mc.set(i[0], i[1]) Until Alan comes with a more round answer, I'd suggest something along the

Re: [Tutor] How to print the installed web browser

2010-09-01 Thread Nick Raptis
On 09/01/2010 11:17 AM, Alan Gauld wrote: Ranjith Kumar ranjitht...@gmail.com wrote I`m using ubuntu how to find and print the installed web browsers using python scripting. How would you do it without Python scripting? Is it even possible? And on a multiuser system like Linux would

Re: [Tutor] How to print the installed web browser

2010-09-01 Thread Nick Raptis
On 09/01/2010 11:46 AM, Nick Raptis wrote: Alan, let me make a wild guess here. Ubuntu does have little Preferred applications config tool. I don't know how or where it stores this data, but my guess is it's the same place xdg (as in xdg-open) gets it's configuration from. This article

Re: [Tutor] input problem

2010-08-22 Thread Nick Raptis
On 08/22/2010 09:35 PM, Roelof Wobben wrote: Hello, I made this programm : def count_letters(n,a): count = 0 for char in n: if char == a: count += 1 return count fruit= letter= fruit= input(Enter a sort of fruit: ) teller = input(Enter the character which must

Re: [Tutor] input problem

2010-08-22 Thread Nick Raptis
On 08/22/2010 09:35 PM, Roelof Wobben wrote: Hello, I made this programm : def count_letters(n,a): count = 0 for char in n: if char == a: count += 1 return count fruit= letter= fruit= input(Enter a sort of fruit: ) teller = input(Enter the character which must

Re: [Tutor] input problem

2010-08-22 Thread Nick Raptis
Please try and reply to the list instead of just me. raw_input did not the trick. fruit.count is the next exercise. Oke, I deleted the initialazion and change teller into letter. Roelof Should be alright now.. Hmmm Can you paste your exact code AND the error you're getting? As I

Re: [Tutor] problem with simple script

2010-07-28 Thread Nick Raptis
On 07/28/2010 02:51 PM, Richard D. Moores wrote: I have a practical need for a script that will give me a random int in the closed interval [n, m]. Please see http://tutoree7.pastebin.com/xeCjE7bV. This works fine when I enter both n and m as, for example, 23, 56, or even 56, 23. But often

Re: [Tutor] String replace question

2010-07-28 Thread Nick Raptis
On 07/28/2010 03:41 PM, Rod wrote: Hello, I need to replace a period (.) in a domain name with a slash period (\.). I'm attempting to use the string replace method to do this. Example: uri = domain.com uri.replace('.', '\.') This returns 'domain\\.com' Of course it does! Try to print

Re: [Tutor] nested list help

2010-07-27 Thread Nick Raptis
On 07/27/2010 04:48 PM, Evert Rol wrote: On the other hand, if you want to combine lists based on their first element, consider using dictionaries and extend lists which have the same key. Depending on how you create the lists (eg, when reading columns from a file), you can actually do this

Re: [Tutor] need help with msvcrt.getch()

2010-07-27 Thread Nick Raptis
On 07/27/2010 05:22 PM, Richard D. Moores wrote: Python 3.1 on Vista. Please see http://tutoree7.pastebin.com/f3TaxDBc. I'm trying to recall what I used to know, thus this simple script. But 'y' or 'q' do nothing. What's wrong? Thanks, Dick Moores Hi Dick! I'm not on Windows here so

Re: [Tutor] Calculating and returning possible combinations of elements from a given set

2010-07-27 Thread Nick Raptis
On 07/28/2010 01:20 AM, ZUXOXUS wrote: Hi all pythoners I've got a probably easy to answer question. Say I've got a collections of strings, e.g.: 'man', 'bat', 'super', 'ultra'. They are in a list, or in a sequence or whatever, say a bag of words And now I want to know how many couples I

Re: [Tutor] Searching a text file's contents and comparing them toalist

2010-07-14 Thread Nick Raptis
On 07/14/2010 11:57 PM, Eric Hamiter wrote: Last question (for today, at least): Right now, the output is less than aesthetically pleasing: (['Located on aisle 1: ', 'bread', 'magazines'], ['Located on aisle 2: ', 'juice', 'ice cream'], ['Located on aisle 3: ', 'asparagus'], ['Not found in the

Re: [Tutor] Python Documentation Clarification

2010-07-12 Thread Nick Raptis
compile(source, filename, mode[, flags[, dont_inherit]]) I see within this built in function, the first argument can be what they define as source, the second argument as the filename and the third as the mode. But what confuses me is sometimes I see a bracket, above as [, flags[,

Re: [Tutor] Function returns 'None'

2010-07-11 Thread Nick Raptis
On 07/11/2010 04:59 PM, Dominik Danter wrote: Hello As en exercise I wrote the following function: def recursfac(x,carryover=1): print 'x:',x,'carryover:', carryover if x 1: carryover *= x recursfac(x-1, carryover) else: return carryover print

Re: [Tutor] Function returns 'None'

2010-07-11 Thread Nick Raptis
On 07/11/2010 06:28 PM, Nick Raptis wrote: def recursfac(x,carryover=1): print 'x:',x,'carryover:', carryover if x 1: carryover *= x carryover = recursfac(x-1, carryover) return carryover And this returns x: 3 carryover: 1 x: 2 carryover: 3 x: 1 carryover: 6 6

Re: [Tutor] Function returns 'None'

2010-07-11 Thread Nick Raptis
On 07/11/2010 06:50 PM, Luke Paireepinart wrote: I think the new version is harder to understand. Sent from my iPhone On Jul 11, 2010, at 10:43 AM, Nick Raptisairsc...@otenet.gr wrote: Aww! A critic! You humble me (really, I'm not being sarcastic here, I welcome it gladly) I won't argue

Re: [Tutor] newbie to gui programming

2010-07-08 Thread Nick Raptis
Thanks a lot for the mails all of you. Someone commented that wxpython occassionally shows it C/C++ roots. Will that haunt me cos' I have zero knowledge of C/C++. That would be me, sorry about that, didn't mean to confuse you further. Well, think it this way, if you have zero knowledge of

Re: [Tutor] Django Read

2010-07-08 Thread Nick Raptis
There actually aren't that many books on django around yet which is a pity. You should definitely read The django book: http://www.djangobook.com/en/2.0/ either on the online version on that link, or it's printed counterpart (yes, it's really the same book):

Re: [Tutor] Having a return when subprocess.Popen finishes

2010-07-08 Thread Nick Raptis
subprocess.Popen is a class, and as such it returns an object which can do a lot of stuff besides just reading the output. What you want to do here is using it's communicate() method as such: output, errors = ping.communicate() Also, there is a quicker way, I think from version 2.7 forward:

Re: [Tutor] newbie to gui programming

2010-07-07 Thread Nick Raptis
, you're such a helpful bunch. Nick On 07/07/2010 10:16 AM, Alan Gauld wrote: Nick Raptis airsc...@otenet.gr wrote Really good news is that on this very list on another thread, someone suggested Dabo http://dabodev.com/ It's a python library on top of wxPython and it's database-logic-GUI But its

Re: [Tutor] differences between mmap and StringIO

2010-07-07 Thread Nick Raptis
Actually, for simple file operations I'd neither. Standard file usage is described here, if you haven't checked it out, which I'm sure you have http://docs.python.org/library/stdtypes.html#file-objects StringIO is useful as a buffer. That is, you make a file-like object in memory with

Re: [Tutor] newbie to gui programming

2010-07-06 Thread Nick Raptis
Please excuse if I'm jumping on the topic. Haven't done any GUI work so this interests me too. wxPython always seemed a great choice as it works on all platforms, and uses GTK+ for linux. Well, what mainly bugs me about wxPython is that most of it's API names come from the wx C library, you

Re: [Tutor] To write data in two different fonts?

2009-08-13 Thread Nick Raptis
Dave Angel wrote: However, if someone had tried to do that in a single call to the current function, their code would already be broken because the dictionary doesn't preserve order, so the substitution might not happen first. Wow, I never thought about the dictionary not being sorted

Re: [Tutor] To write data in two different fonts?

2009-08-12 Thread Nick Raptis
Your main concern when displaying plain text in HTML is actually only 5 characters: , , , , ' which you should escape(replace) with their coresponding HTML entities. Here's a few lines of code to give you an idea how to do it: #put this

Re: [Tutor] To write data in two different fonts?

2009-08-12 Thread Nick Raptis
Dave Angel wrote: As I said, you'd probably get in trouble if any of the lines had '' or '' characters in them. The following function from the standard library can be used to escape the line directly, or of course you could use the function Nick supplied. xml.sax.saxutils.escape(/data/[,

Re: [Tutor] droplet like behaviour in Python

2009-08-11 Thread Nick Raptis
pedro wrote: #!/usr/bin/env python # encoding: utf-8 import sys theFilePath = sys.argv[1] print theFilePath But when I try to drop something on it nothing happens. Sorry I guess there is something fundamental that I am missing. Pete Pedro, I'll reply to this message instead of the last

Re: [Tutor] droplet like behaviour in Python

2009-08-11 Thread Nick Raptis
specific rather than python/script specific. That turns the question it to a whole new direction for me. Nick Nick Raptis wrote: pedro wrote: #!/usr/bin/env python # encoding: utf-8 import sys theFilePath = sys.argv[1] print theFilePath But when I try to drop something on it nothing

Re: [Tutor] clear screen inside python interpreter

2009-08-06 Thread Nick Raptis
I don't think there's a Python command to do this. You can always print enough newlines to clear your view of the window: print \n * 80 or use os.system to issue a command the shell/terminal/cmd will understand import os os.system(cls) or import os os.system(clear) I resently made a 'game