Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-13 Thread Alister
On Mon, 13 May 2013 05:23:16 +0600, Mr. Joe wrote: > I seem to stumble upon a situation where "!=" operator misbehaves in > python2.x. Not sure if it's my misunderstanding or a bug in python > implementation. Here's a demo code to reproduce the behavior - > """ > # -*- coding: utf-8 -*- > from __f

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-13 Thread Alister
On Mon, 13 May 2013 19:28:29 +0100, Fábio Santos wrote: > I think it is more readable. When doing more complicated statements I > use != instead, but when it's a single test I prefer not … == > > It's a personal thing. It may also have to do with the fact that I > didn't know python had != when I

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-15 Thread Alister
> != is explicit. > > There is no ambiguity that needs to be guessed. Which is why i said it thought X != Y is cleaner i guess i wasn't totally clear, I would write X != Y its because the OP preferred to use the other format I recommended that he made the operator ordering explicit. -- Na

Re: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Alister
On Tue, 21 May 2013 23:52:30 -0700, Kevin Xi wrote: > On Wednesday, May 22, 2013 2:23:15 PM UTC+8, C. N. Desrosiers wrote: >> Hi, >> > Hi, >> >> I'm just starting out with Python and to practice I am trying to write >> a script that can have a simple conversation with the user. >> > So you may

Re: Reading *.json from URL - json.loads() versus urllib.urlopen.readlines()

2013-05-28 Thread Alister
On Tue, 28 May 2013 08:31:35 +0100, Fábio Santos wrote: > On 28 May 2013 04:19, "Bryan Britten" wrote: >> I'm not familiar with using read(4096), I'll have to look into that. >> When > I tried to just save the file, my computer just sat in limbo for some > time and didn't seem to want to process

Re: How clean/elegant is Python's syntax?

2013-05-31 Thread Alister
On Thu, 30 May 2013 20:38:40 +0100, MRAB wrote: > On 30/05/2013 19:44, Chris Angelico wrote: >> On Fri, May 31, 2013 at 4:36 AM, Ian Kelly >> wrote: >>> On Wed, May 29, 2013 at 8:49 PM, rusi wrote: On May 30, 6:14 am, Ma Xiaojun wrote: > What interest me is a one liner: > print '\n

Re: How clean/elegant is Python's syntax?

2013-05-31 Thread Alister
On Fri, 31 May 2013 03:27:52 -0700, rusi wrote: > On May 31, 2:08 pm, Alister wrote: >> On Thu, 30 May 2013 20:38:40 +0100, MRAB wrote: >> > And additional argument (pun not intended) for putting sep second is >> > that you can give it a default value: >>

Re: Create a file in /etc/ as a non-root user

2013-05-31 Thread Alister
On Fri, 31 May 2013 07:11:58 -0400, Dave Angel wrote: > On 05/31/2013 05:27 AM, Luca Cerone wrote: >>> fd = open('/etc/file','w') >>> >>> fd.write('jpdas') >>> >>> fd.close() >>> >>> >> Hi Bibhu, that is not a Python problem, but a permission one. >> You should configure the permissions so that yo

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Alister
On Fri, 31 May 2013 08:20:54 -0700, Νικόλαος Κούρας wrote: > I'am using CentOS v6.4 on my VPS and hence 'yum' install manager and i > just tried: > > Code: > root@nikos [~]# which python /usr/bin/python root@nikos [~]# which > python3 /root/.local/lib/python2.7/bin/python3 root@nikos [~]# which >

Re: PyWart: The problem with "print"

2013-06-03 Thread Alister
On Mon, 03 Jun 2013 17:17:12 +1000, Chris Angelico wrote: > On Mon, Jun 3, 2013 at 3:49 PM, Michael Torrie > wrote: >> On 06/02/2013 12:18 PM, Rick Johnson wrote: >>> On Sunday, June 2, 2013 12:49:02 PM UTC-5, Dan Sommers wrote: On Mon, 03 Jun 2013 03:20:52 +1000, Chris Angelico wrote: >

Re: I just wrote my first Python program a guessing game and it exits with an error I get this.

2013-06-05 Thread Alister
On Wed, 05 Jun 2013 07:40:52 -0700, Armando Montes De Oca wrote: > Traceback (most recent call last): > File "Guessing_Game.py", line 32, in > input (enter) > File "", line 0 > ^ > SyntaxError: unexpected EOF while parsing -- > (program exited with code: 1) > This is t

Re: PyGame tutorial?

2013-06-11 Thread Alister
On Tue, 11 Jun 2013 09:57:17 -0700, Eam onn wrote: > On Tuesday, June 11, 2013 5:31:22 PM UTC+1, Mark Lawrence wrote: >> On 11/06/2013 16:47, Eam onn wrote: >> >> > Is there a PyGame tutorial out there? I've seen TheNewBoston's tuts, >> > but he didn't finish his. MetalX100 did a VERY good tutori

Re: My son wants me to teach him Python

2013-06-14 Thread Alister
On Fri, 14 Jun 2013 05:41:20 -0500, Tim Chase wrote: > On 2013-06-14 17:21, Chris Angelico wrote: >> On Fri, Jun 14, 2013 at 4:13 PM, Steven D'Aprano >> wrote: >> > Here's another Pepsi Challenge for you: >> > >> > There is a certain directory on your system containing 50 text files, >> > and 50

Re: RFD: rename comp.lang.python to comp.support.superhost

2013-06-15 Thread Alister
On Sat, 15 Jun 2013 20:29:09 +0300, Nick the Gr33k wrote: > On 15/6/2013 8:11 μμ, Chris “Kwpolska” Warrick wrote: >> On Fri, Jun 14, 2013 at 5:25 AM, alex23 wrote: >>> On Jun 14, 2:24 am, Νικόλαος Κούρας wrote: iam researchign a solution to this as we speak. >>> >>> Spamming endless "ZOMG H

Re: Updating a filename's counter value failed each time

2013-06-17 Thread Alister
On Mon, 17 Jun 2013 21:06:16 +0300, Νίκος wrote: > > But the comma inside the execute statement doesn't protect me from such > actions opposed when i was using a substitute operator? You are correct Nicos, passing the values as a parameter list does protect you from SQL injection JT has made an

Re: Updating a filename's counter value failed each time

2013-06-17 Thread Alister
On Mon, 17 Jun 2013 22:30:57 +0300, Νίκος wrote: > On 17/6/2013 10:05 μμ, Alister wrote: >> You are correct Nicos, passing the values as a parameter list does >> protect you from SQL injection JT has made an error. > > Even if the query is somehting like: > >

Re: Updating a filename's counter value failed each time

2013-06-17 Thread Alister
On Mon, 17 Jun 2013 19:16:02 +, Jens Thoms Toerring wrote: > MRAB wrote: >> On 17/06/2013 19:32, Jens Thoms Toerring wrote: >> > As I wrote you need *single* quotes around strings in SQL statements. >> > Double quotes won't do - this is SQL and not Python so you're dealing >> > with a differe

Re: Updating a filename's counter value failed each time

2013-06-17 Thread Alister
On Mon, 17 Jun 2013 22:28:47 +0300, Νίκος wrote: > On 17/6/2013 10:19 μμ, John Gordon wrote: >> Print the cur.rowcount attribute, which contains the number of rows >> that were affected by the update. If it's zero, that should tell you >> something. > > > #update file's counter if cookie does n

Re: Updating a filename's counter value failed each time

2013-06-17 Thread Alister
On Mon, 17 Jun 2013 20:44:03 +, John Gordon wrote: > In Alister > writes: > >> > #update file's counter if cookie does not exist cur.execute('''UPDATE >> > files SET hits = hits + 1, host = %s, lastvisit = >> > %s WHERE url = %s'

Re: Updating a filename's counter value failed each time

2013-06-17 Thread Alister
On Mon, 17 Jun 2013 20:26:57 +, Alister wrote: > On Mon, 17 Jun 2013 22:30:57 +0300, Νίκος wrote: > >> On 17/6/2013 10:05 μμ, Alister wrote: >>> You are correct Nicos, passing the values as a parameter list does >>> protect you from SQL injection JT has mad

Re: My son wants me to teach him Python

2013-06-17 Thread Alister
On Sun, 16 Jun 2013 15:33:29 -0700, Rick Johnson wrote: > On Sunday, June 16, 2013 4:52:16 PM UTC-5, Chris Angelico wrote: > >> Okay... I'm trying to get my head around what you've done here. Isn't >> it simply that you've made a way to, with what looks like a >> point-and-click interface, let th

Re: Does upgrade from 2.7.3 to 2.7.5 require uninstall?

2013-06-20 Thread Alister
On Thu, 20 Jun 2013 11:35:49 -0700, Wanderer wrote: > Do I need to uninstall Python 2.7.3 before installing Python 2.7.5? > > Thanks that will depend on your operating system an possibly the variety of python -- I don't even butter my bread. I consider that cooking. -- Kath

Re: n00b question on spacing

2013-06-22 Thread Alister
On Sat, 22 Jun 2013 17:11:00 +0100, Joshua Landau wrote: > On 22 June 2013 16:55, Rick Johnson > wrote: >> On Saturday, June 22, 2013 10:40:24 AM UTC-5, Joshua Landau wrote: >>> > Plus, your use of the format syntax is incorrect. >>> Wut? >> >> Well what i mean exactly is not that it's illegal, i

Re: Limit Lines of Output

2013-06-26 Thread Alister
On Tue, 25 Jun 2013 14:39:30 -0600, Ian Kelly wrote: > On Tue, Jun 25, 2013 at 2:31 PM, Joshua Landau > wrote: >> On 25 June 2013 21:22, Bryan Britten wrote: >>> Ah, I always forget to mention my OS on these forums. I'm running >>> Windows. >> >> Supposedly, Windows has "more" >> [http://superus

Re: "private" class attributes

2013-06-27 Thread Alister
On Wed, 26 Jun 2013 23:28:49 -0700, wgtrey wrote: > good question but a very poor reply, you should at least quote SOME of the original post to give context. especially as msg threading in this newsgroup is less than perfect. -- How sharper than a serpent's tooth is a sister's "See?"

Re: Newbie. Need help

2013-07-08 Thread Alister
On Mon, 08 Jul 2013 01:53:06 -0700, Sanza101 wrote: > I just started using Python recently, and i need help with the > following: Please assist. > > 1.Create another function that generates a random number (You will have > to import the relevant library to do this) > 2.Create a function

Re: Wedding Planning Shortcuts

2013-07-11 Thread Alister
On Wed, 10 Jul 2013 23:42:14 -0700, fletcherbenjiaa wrote: > A wedding is truly a labor of love for most engaged couples, and it's > natural to feel a bit wary of the wedding planning process. However, it > doesn't have to be so intimidating or cumbersome. Sure there are lots of > details in even

Re: Critic my module

2013-07-26 Thread Alister
> > The main point of this is for shell users that are using Python and do > not know some of the Python commands. This module would make Python more > like a Linux shell. For instance, a shell user would type boash.uname() > because they may not know they can type "import platform; > platform.una

Re: Critic my module

2013-07-27 Thread Alister
On Sat, 27 Jul 2013 08:56:10 -0400, Devyn Collier Johnson wrote: > > Good point about the Made by/Copyright suggestion. Although, I have not > copyrighted the file, can I still say "Copyrighted by ...".-- There is no special process to Copyright anything. the simple act of writing it automatical

Re: 回复: how can I implement "cd" like shell in Python?

2012-06-28 Thread Alister
On Thu, 28 Jun 2012 20:28:40 +0800, Alex chen wrote: > I just want to write a python program,it can be called in the linux > terminal like the command "cd" to change the directory of the shell > terminal > > > That would not only be needlesly re-inventing the wheel but making it square in the

Re: code review

2012-06-29 Thread Alister
On Fri, 29 Jun 2012 09:03:22 -0600, Littlefield, Tyler wrote: > On 6/29/2012 1:31 AM, Steven D'Aprano wrote: >> On Thu, 28 Jun 2012 20:58:15 -0700, alex23 wrote: >> >>> On Jun 29, 12:57 pm, "Littlefield, Tyler" wrote: I was curious if someone wouldn't mind poking at some code. The proje

Re: code review

2012-06-29 Thread Alister
On Fri, 29 Jun 2012 13:27:54 -0700, Martin P. Hellwig wrote: > On Friday, 29 June 2012 20:41:11 UTC+1, Alister wrote: >> On Fri, 29 Jun 2012 09:03:22 -0600, Littlefield, Tyler wrote: >> >> > On 6/29/2012 1:31 AM, Steven D'Aprano wrote: >> >> On Thu,

Re: code review

2012-06-30 Thread Alister
On Sat, 30 Jun 2012 02:28:52 +, Steven D'Aprano wrote: > On Fri, 29 Jun 2012 19:41:11 +, Alister wrote: > >> also this section in main strikes me as a bit odd and convoluted >> >> w = world() >> serv = server(client) >> w.server = s

Re: code review

2012-06-30 Thread Alister
On Fri, 29 Jun 2012 14:49:11 -0600, Littlefield, Tyler wrote: > I am no expert but from what have picked up so far from x import is > frowned upon in most cases also this section in main strikes me as a bit > odd and convoluted w = world() serv = server(client) w.server = serv > serv.world = w I t

Re: code review

2012-06-30 Thread Alister
On Sat, 30 Jun 2012 09:31:53 +, Alister wrote: > On Fri, 29 Jun 2012 14:49:11 -0600, Littlefield, Tyler wrote: > >> I am no expert but from what have picked up so far from x import is >> frowned upon in most cases also this section in main strikes me as a >> bit odd

Re: code review

2012-06-30 Thread Alister
On Fri, 29 Jun 2012 09:03:22 -0600, Littlefield, Tyler wrote: > On 6/29/2012 1:31 AM, Steven D'Aprano wrote: >> On Thu, 28 Jun 2012 20:58:15 -0700, alex23 wrote: >> >>> On Jun 29, 12:57 pm, "Littlefield, Tyler" wrote: I was curious if someone wouldn't mind poking at some code. The proje

Re: code review

2012-06-30 Thread Alister
On Sat, 30 Jun 2012 12:29:31 +0200, Peter Otten wrote: > Alister wrote: > >> I think I may be on firmer grounds with the next few: >> >> isValidPassword can be simplified to >> >> def isValidPassword(password: >> count=len(password) >&

Re: code review

2012-06-30 Thread Alister
On Sat, 30 Jun 2012 21:38:58 +0200, Thomas Jollans wrote: > On 06/30/2012 08:39 PM, Thomas 'PointedEars' Lahn wrote: >> Peter Otten wrote: >> >>> If you spell it >>> >>> def is_valid_password(password): >>> return mud.minpass <= len(password) <= mud.maxpass >>> >>> it is even easier to see th

Re: changes made to my python coded com servers are not taking effect

2012-07-01 Thread Alister
On Sun, 01 Jul 2012 02:13:23 -0700, Panceisto wrote: > I assume the old code keeps running in some process somewhere. How to > fix this? stop & restart the servers after making the changes -- Smoking is the leading cause of statistics. -- http://mail.python.org/mailman/listinfo/python-list

Re: code review

2012-07-01 Thread Alister
On Sat, 30 Jun 2012 23:45:25 -0500, Evan Driscoll wrote: > On 6/30/2012 19:37, Chris Angelico wrote: >> On Sun, Jul 1, 2012 at 10:08 AM, Ben Finney >> wrote: >>> I know of no programming language that would give a newcomer to Python >>> that expectation. So where is the norm you're referring to?

Re: lambda in list comprehension acting funny

2012-07-12 Thread Alister
On Wed, 11 Jul 2012 08:43:11 +0200, Daniel Fetchinson wrote: >> funcs = [ lambda x: x**i for i in range( 5 ) ] >> print funcs[0]( 2 ) >> print funcs[1]( 2 ) >> print funcs[2]( 2 ) >> >> This gives me >> >> 16 16 16 >> >> When I was excepting >> >> 1 >> 2 >> 4 >> >> Does anyone know why? > > And m

Re: Converting a list of strings into a list of integers?

2012-07-22 Thread Alister
On Sun, 22 Jul 2012 10:29:44 -0500, Tony the Tiger wrote: > Hi, > Is there such a thing in the language, or do I have to invent it myself? > > I came up with the following: > > # options.modus_list contains, e.g., "[2,3,4]" > # (a string from the command line) > # MODUS_LIST contains, e.g.,

Re: OT: Text editors (was Re: Search and replace text in XML file?)

2012-07-28 Thread Alister
On Sun, 29 Jul 2012 01:51:48 +1000, Chris Angelico wrote: > On Sat, Jul 28, 2012 at 6:29 PM, Mark Lawrence > wrote: >> I highly recommend the use of notepad++. If anyone knows of a better >> text editor for Windows please let me know :) > > My current preference is SciTE, available on Linux and

Re: Linux shell to python

2012-07-31 Thread Alister
On Tue, 31 Jul 2012 08:15:32 +0100, Mark Lawrence wrote: > On 31/07/2012 02:20, Dennis Lee Bieber wrote: >> On Mon, 30 Jul 2012 22:56:48 +, Dan Stromberg >> declaimed the following in gmane.comp.python.general: >> >> >>> Sigh, and I'm also not keen on multi-line list comprehensions, >>> speci

Re: Is there a clever way to pass arguments

2012-08-09 Thread Alister
On Thu, 09 Aug 2012 19:13:31 +1000, Chris Angelico wrote: > On Thu, Aug 9, 2012 at 7:05 PM, Jean-Michel Pichavant > wrote: >> bruceg113...@gmail.com wrote: >>> >>> I cannot change the function definition. >> >> or better (imo) >> testData(z) and make testData handle a list (8 parameters, that's a

Re: Arithmetic with Boolean values

2012-08-12 Thread Alister
On Sun, 12 Aug 2012 19:20:26 +0100, Mark Lawrence wrote: > On 12/08/2012 17:59, Paul Rubin wrote: >>> which can be simplified to: >>> for x in range(len(L)//2 + len(L)%2): >> >> for x in range(sum(divmod(len(L), 2))): ... >> >> > So who's going to be first in with "and thou shalt not count to 4...

Re: save dictionary to a file without brackets.

2012-08-14 Thread Alister
On Tue, 14 Aug 2012 12:33:20 +0100, Mark Lawrence wrote: > On 14/08/2012 03:54, Steven D'Aprano wrote: >> On Mon, 13 Aug 2012 18:07:26 +0100, Mark Lawrence wrote: >> >>> On 13/08/2012 17:14, alex23 wrote: On Aug 13, 10:37 pm, Mark Lawrence wrote: > Why on your say so? My mistak

Re: How do I display unicode value stored in a string variable using ord()

2012-08-16 Thread Alister
On Thu, 16 Aug 2012 15:09:47 -0700, Charles Jensen wrote: > Everyone knows that the python command > > ord(u'…') > > will output the number 8230 which is the unicode character for the > horizontal ellipsis. > > How would I use ord() to find the unicode value of a string stored in a > varia

Re: remote read eval print loop

2012-08-16 Thread Alister
On Fri, 17 Aug 2012 02:27:42 +, Steven D'Aprano wrote: > On Fri, 17 Aug 2012 08:43:50 +1000, Chris Angelico wrote: > >> On Fri, Aug 17, 2012 at 6:54 AM, Eric Frederich >> wrote: >>> Hello, >>> >>> I have a bunch of Python bindings for a 3rd party software running on >>> the server side. >>>

Re: Tkinter bug in Entry widgets on OS X

2012-08-31 Thread Alister
On Fri, 31 Aug 2012 11:21:14 -0400, Kevin Walzer wrote: > On 8/31/12 11:18 AM, Arnaud Delobelle wrote: > > >> I'm not trying to do anything. When a user presses the UP or DOWN >> arrow, then a strange character is inserted in the Entry box. I'd >> rather nothing happened. >> > Why is the user

Re: avoid the redefinition of a function

2012-09-12 Thread Alister
On Wed, 12 Sep 2012 06:15:21 -0700, Ramchandra Apte wrote: > On Wednesday, 12 September 2012 18:26:36 UTC+5:30, Jabba Laci wrote: >> Hi, >> >> >> >> I have an installer script that contains lots of little functions. It >> >> has an interactive menu and the corresponding function is called. Ov

Re: using text file to get ip address from hostname

2012-09-12 Thread Alister
On Wed, 12 Sep 2012 07:41:10 -0700, dkatorza wrote: > בתאריך יום רביעי, 12 בספטמבר 2012 17:24:50 UTC+3, מאת dkat...@gmail.com: >> hello , >> >> >> >> i'm new to Python and i searched the web and could not find an answer >> for my issue. >> >> >> >> i need to get an ip address from list of ho

Re: avoid the redefinition of a function

2012-09-12 Thread Alister
On Wed, 12 Sep 2012 18:56:46 +0200, Jabba Laci wrote: >> For example: >> >> def install_java(): >>pass >> >> def install_tomcat(): >>pass > > Thanks for the answers. I decided to use numbers in the name of the > functions to facilitate function calls. Now if you have this menu option > fo

Re: avoid the redefinition of a function

2012-09-13 Thread Alister
On Thu, 13 Sep 2012 10:23:22 +0200, Peter Otten wrote: > MRAB wrote: > >> On 12/09/2012 19:04, Alister wrote: >>> On Wed, 12 Sep 2012 18:56:46 +0200, Jabba Laci wrote: >>> >>>>> For example: >>>>> >>>>> def in

Re: Python presentations

2012-09-13 Thread Alister
> Also try to keep the presentation interactive by asking questions to > your audience (unless some of them are already participating), otherwise > people will be snoring or texting after 20 minutes. That is a v good suggestion. the best presentation I ever attended was one on using an emergency l

Re: sum works in sequences (Python 3)

2012-09-19 Thread Alister
On Wed, 19 Sep 2012 16:41:20 +0200, Franck Ditter wrote: > Hello, > I wonder why sum does not work on the string sequence in Python 3 : > sum((8,5,9,3)) > 25 sum([5,8,3,9,2]) > 27 sum('rtarze') > TypeError: unsupported operand type(s) for +: 'int' and 'str' > > I naively thought t

Re: Blue Screen Python

2012-09-21 Thread Alister
On Fri, 21 Sep 2012 15:14:53 +, Grant Edwards wrote: > On 2012-09-21, mikcec82 wrote: >> Hallo to all, >> >> I'm using Python 2.7.3 with Windows 7 @ 64 bit and an Intel Core i3 >> -2350M CPU @2.30GHz 2.3GHz. >> >> Sometimes, when I'm programming in Python on my screen compare this > Python is

Re: Blue Screen Python

2012-09-21 Thread Alister
On Fri, 21 Sep 2012 16:01:16 +, Alister wrote: > On Fri, 21 Sep 2012 15:14:53 +, Grant Edwards wrote: > >> On 2012-09-21, mikcec82 wrote: >>> Hallo to all, >>> >>> I'm using Python 2.7.3 with Windows 7 @ 64 bit and an Intel Core i3 >>>

Re: Print Function

2012-09-21 Thread Alister
On Fri, 21 Sep 2012 14:54:14 -0600, Ian Kelly wrote: > On Fri, Sep 21, 2012 at 2:28 PM, Rodrick Brown > wrote: >> Go away troll! > > Troll? It looked like a sincere question to me. but one that page 1 of the documentation would answer. -- Waste not, get your budget cut next year. -- http:/

Re: Exact integer-valued floats

2012-09-21 Thread Alister
On Fri, 21 Sep 2012 17:29:13 +, Steven D'Aprano wrote: > Python floats can represent exact integer values (e.g. 42.0), but above > a certain value (see below), not all integers can be represented. For > example: > > py> 1e16 == 1e16 + 1 # no such float as 10001.0 True py> > 1e16

Re: Blue Screen Python

2012-09-22 Thread Alister
On Fri, 21 Sep 2012 18:47:57 -0400, Dave Angel wrote: > On 09/21/2012 12:01 PM, Alister wrote: >> On Fri, 21 Sep 2012 15:14:53 +, Grant Edwards wrote: >> >>> On 2012-09-21, mikcec82 wrote: >>>> Hallo to all, >>>> >>>> I'

Re: One of my joomla webpages has been hacked. Please help.

2012-09-22 Thread Alister
On Sat, 22 Sep 2012 18:07:32 +1000, Chris Angelico wrote: > On Sat, Sep 22, 2012 at 5:13 PM, Νίκος Γκρεεκ > wrote: >> The web host company pulled a previous backup and now its all good. >> >> My apologies for the annoyance i have coused you all i wanted was some >> insight so to make sure this wo

Re: One of my joomla webpages has been hacked. Please help.

2012-09-22 Thread Alister
On Sat, 22 Sep 2012 13:09:36 +, Steven D'Aprano wrote: > On Sat, 22 Sep 2012 11:13:43 +0100, Kev Dwyer wrote: > >> This is only speculation, as I don't know exactly how your web page has >> been "hacked", but if your page somehow exposes a database connection, >> and the hack involves changin

Re: regular expression : the dollar sign ($) work with re.match() or re.search()

2012-09-26 Thread Alister
On Wed, 26 Sep 2012 10:48:00 +0300, Jussi Piitulainen wrote: > iMath writes: > >> I only know the dollar sign ($) will match a pattern from the end of a >> string, but which method does it work with, re.match() or re.search() > > It works with both. With re.match, the pattern has to match at the

Re: howto handle nested for

2012-09-28 Thread Alister
On Fri, 28 Sep 2012 10:39:32 -0400, Neal Becker wrote: > I know this should be a fairly basic question, but I'm drawing a blank. > > I have code that looks like: > > for s0 in xrange (n_syms): > for s1 in xrange (n_syms): > for s2 in xrange (n_syms): > for

Re: Coexistence of Python 2.x and 3.x on same OS

2012-10-01 Thread Alister
On Sun, 30 Sep 2012 15:14:17 -0400, Edward Diener wrote: > Has there been any official software that allows both the Python 2.x and > 3.x releases to coexist on the same OS so that the end-user can easily > switch between them when invoking Python scripts after each has been > installed to their o

Re: Proper place for everything

2012-11-02 Thread Alister
On Fri, 02 Nov 2012 04:20:20 -0700, Jason Benjamin wrote: > Anybody know of the appropriate place to troll and flame about various > Python related issues? I'm kind of mad about some Python stuff and I > need a place to vent where people may or may not listen, but at at least > respond. Thought

Re: stackoverflow quote on Python

2012-11-13 Thread Alister
On Tue, 13 Nov 2012 03:08:54 +, Mark Lawrence wrote: > http://stackoverflow.com/questions/tagged/python > > "Python has two major versions (2 and 3) in use which have significant > differences." > > I believe that this is incorrect. The warts have been removed, but > significant differences

Re: debugging in eclipse

2012-11-15 Thread Alister
On Thu, 15 Nov 2012 05:46:49 -0800, chip9munk wrote: > On Thursday, November 15, 2012 2:44:22 PM UTC+1, Martin P. Hellwig > wrote: >> I assume you have at the end of the debugTest.py file something like >> this: >> if __name__ == '__main__': >>test() > > no i did not have it... > > is main r

Re: Point of idle curiosity

2012-11-19 Thread Alister
On Sun, 18 Nov 2012 16:08:34 +, Mark Lawrence wrote: > On 18/11/2012 15:59, Steven D'Aprano wrote: >> On Sun, 18 Nov 2012 22:45:43 +1100, Chris Angelico wrote: >> >>> (if you'll forgive the pun) >>> >>> Is IDLE named after Eric of that name, or is it pure coincidence? >> >> Well, IDLE is an ID

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Alister
On Wed, 21 Nov 2012 04:43:57 -0800, Giacomo Alzetta wrote: > I just came across this: > 'spam'.find('', 5) > -1 > > > Now, reading find's documentation: > print(str.find.__doc__) > S.find(sub [,start [,end]]) -> int > > Return the lowest index in S where substring sub is found, > su

Re: Print value from array

2012-11-22 Thread Alister
On Thu, 22 Nov 2012 10:44:02 -0800, Mike wrote: > Hello, > I am noob en python programing, i wrote a perl script for read from csv > but now i wish print value but the value must be within double quote and > I can not do this. > > For example now the output is: > > ma user@domain displayName Na

Re: The curses module and licensing

2012-12-06 Thread Alister
On Thu, 06 Dec 2012 19:34:04 +0100, benjamin schnitzler wrote: > I think I have accidentially not sent this to the python list: > > On 02:17 Fri 07 Dec , Chris Angelico wrote: >> Hi! >> >> Here's some info on ncurses: >> >> http://invisible-island.net/ncurses/ncurses.faq.html >> >> I would ge

Re: Why Doesn't This MySQL Statement Execute?

2012-12-19 Thread Alister
On Tue, 18 Dec 2012 17:34:08 -0400, Tom Borkin wrote: > Hi; > I have this test code: > > if i_id == "1186": > sql = 'insert into interactions values(Null, %s, "Call Back","% s")' % (i_id, date_plus_2) > cursor.execute(sql) Please don't build your sql strings like this but pass th

Re: how to detect the character encoding in a web page ?

2012-12-24 Thread Alister
On Mon, 24 Dec 2012 13:50:39 +, Steven D'Aprano wrote: > On Mon, 24 Dec 2012 13:16:16 +0100, Kwpolska wrote: > >> On Mon, Dec 24, 2012 at 9:34 AM, Kurt Mueller >> wrote: >>> $ wget -q -O - http://python.org/ | chardetect.py stdin: ISO-8859-2 >>> with confidence 0.803579722043 $ >> >> And it

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Alister
On Thu, 27 Dec 2012 12:01:16 -0800, mogul wrote: > 'Aloha! > > I'm new to python, got 10-20 years perl and C experience, all gained on > unix alike machines hacking happily in vi, and later on in vim. > > Now it's python, and currently mainly on my kubuntu desktop. > > Do I really need a real I

Re: Question on for loop

2013-01-04 Thread Alister
On Thu, 03 Jan 2013 12:04:03 -0800, subhabangalore wrote: > Dear Group, > If I take a list like the following: > > fruits = ['banana', 'apple', 'mango'] > for fruit in fruits: >print 'Current fruit :', fruit > > Now, > if I want variables like var1,var2,var3 be assigned to them, we may > ta

Re: Yet another attempt at a safe eval() call

2013-01-04 Thread Alister
On Fri, 04 Jan 2013 13:33:41 +, Steven D'Aprano wrote: > On Fri, 04 Jan 2013 07:24:04 -0500, Terry Reedy wrote: > >> On 1/3/2013 6:25 PM, Grant Edwards wrote: >>> >>> I've written a small assembler in Python 2.[67], and it needs to >>> evaluate integer-valued arithmetic expressions in the con

Re: How do you call a function several times in this context??

2013-01-06 Thread Alister
On Sun, 06 Jan 2013 12:26:40 -0800, kofi wrote: > Using python 3.1, I have written a function called "isEvenDigit" > > Below is the code for the "isEvenDigit" function: > > def isEvenDigit(): > ste=input("Please input a single character string: ") > li=["0","2","4", "6", "8"] > if st

Re: How do you call a function several times in this context??

2013-01-06 Thread Alister
On Sun, 06 Jan 2013 14:33:26 -0700, Jason Friedman wrote: >> def double(value): >> result return result >> >> number=input('type a number') >> print (double(int(number))) >> >> > I think what was meant: > > def double(value): > result = 2 * value return result yes indeed thanks for c

Re: How to get the selected text of the webpage in chrome through python ?

2013-01-09 Thread Alister
On Mon, 07 Jan 2013 20:20:28 -0800, iMath wrote: > How to get the selected text of the webpage in chrome through python ? i think you need to explain your requirement further also what do you want to do to the text once you have it? -- Genius is one percent inspiration and ninety-nine perce

Re: new to python and programming at large

2013-01-09 Thread Alister
On Thu, 10 Jan 2013 02:18:11 +1100, Chris Angelico wrote: > On Thu, Jan 10, 2013 at 8:03 AM, wrote: >> pls I want to write a function that can compute for the sqrt root of >> any number.bt it not working pls help. >> from math import sqrt def squareroot(self): >> x = sqrt(y) >> print x

Re: Probabilistic unit tests?

2013-01-11 Thread Alister
On Thu, 10 Jan 2013 17:59:05 -0800, Nick Mellor wrote: > Hi, > > I've got a unit test that will usually succeed but sometimes fails. An > occasional failure is expected and fine. It's failing all the time I > want to test for. > > What I want to test is "on average, there are the same number of

Re: RE Help splitting CVS data

2013-01-21 Thread Alister
On Sun, 20 Jan 2013 16:41:12 -0800, Garry wrote: > On Sunday, January 20, 2013 3:04:39 PM UTC-7, Garry wrote: >> I'm trying to manipulate family tree data using Python. >> >> I'm using linux and Python 2.7.3 and have data files saved as Linux >> formatted cvs files >> >> The data appears in this

Re: Python usage numbers

2012-02-12 Thread alister
On Sun, 12 Feb 2012 12:11:01 +, Mark Lawrence wrote: > On 12/02/2012 08:26, Matej Cepl wrote: >> On 12.2.2012 09:14, Matej Cepl wrote: Obvious answers: - Try decoding with UTF8 or Latin1. Even if you don't get the right characters, you'll get *something*. - Use op

Re: python scripts solution for euler projects

2012-02-29 Thread alister
On Tue, 28 Feb 2012 19:59:40 -0800, scripts examples wrote: > Got a web site setup for solving euler problems in python, perl, > ruby and javascript. > >Feel free to give me any feedback, thanks. Failing to give a link to the site is a pretty fundamental failure -- Please take note: --

Re: Python is readable

2012-03-18 Thread alister
On Thu, 15 Mar 2012 00:34:47 +0100, Kiuhnm wrote: > I've just started to read >The Quick Python Book (2nd ed.) > The author claims that Python code is more readable than Perl code and > provides this example: > > --- Perl --- > sub pairwise_sum { > my($arg1, $arg2) = @_; > my(@resul

Re: Email Id Verification

2012-05-24 Thread alister
On Thu, 24 May 2012 05:32:16 -0700, niks wrote: > Hello everyone.. > I am new to asp.net... > I want to use Regular Expression validator in Email id verification.. > Can anyone tell me how to use this and what is the meaning of this > \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* this is not reall

Re: Python Book for a C Programmer?

2012-05-24 Thread alister
On Wed, 23 May 2012 16:45:05 -0700, hsaziz wrote: > I am trying to join an online class that uses python. I need to brush up > on the language quickly. Is there a good book or resource that covers it > well but does not have to explain what an if..then..else statement is? > > Thanks. Dive into p

Re: Python libraries portable?

2012-06-08 Thread Alister
On Thu, 07 Jun 2012 20:20:47 +, jkells wrote: > We are new to developing applications with Python. A question came up > concerning Python libraries being portable between Architectures. > More specifically, can we take a python library that runs on a X86 > architecture and run it on a SPAR

Re: what gui designer is everyone using

2012-06-08 Thread Alister
On Thu, 07 Jun 2012 20:58:09 -0700, CM wrote: > On Jun 5, 10:10 am, Mark R Rivet wrote: >> I want a gui designer that writes the gui code for me. I don't want to >> write gui code. what is the gui designer that is most popular? >> I tried boa-constructor, and it works, but I am concerned about ho

Re: Make sure you removed all debugging print statements error

2016-08-10 Thread alister
On Tue, 09 Aug 2016 19:53:56 -0700, Lawrence D’Oliveiro wrote: > On Tuesday, August 9, 2016 at 4:20:37 AM UTC+12, Chris Angelico wrote: >> Firstly, the bare "except:" clause should basically never be used; >> instead, catch a very specific exception and figure out what you want >> to do here > >

Re: Make sure you removed all debugging print statements error

2016-08-10 Thread alister
On Wed, 10 Aug 2016 09:23:40 +, alister wrote: > On Tue, 09 Aug 2016 19:53:56 -0700, Lawrence D’Oliveiro wrote: > >> On Tuesday, August 9, 2016 at 4:20:37 AM UTC+12, Chris Angelico wrote: >>> Firstly, the bare "except:" clause should basically never be

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread alister
On Mon, 15 Aug 2016 07:00:47 -0700, Sickfit92 wrote: > 1. How long did it take you guys to master the language or, let me put > it this way to completely get the hang and start writing code? > > 2. What made you want to learn python? > > 3. Was it difficult to learn the language? > > 4. Have yo

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread alister
On Mon, 15 Aug 2016 11:35:07 -0700, sohcahtoa82 wrote: > On Monday, August 15, 2016 at 8:07:32 AM UTC-7, alister wrote: >> On Mon, 15 Aug 2016 07:00:47 -0700, Sickfit92 wrote: >> >> > 1. How long did it take you guys to master the language or, let me >> > put

libdivecomputer

2016-08-23 Thread alister
Does anyone know if there is a python module avaialbe to interact with this library (it is for downloading data down various Decompression computers so a bit of a specialist market) I already have an application that works fine (sub-surface) so this is more of a curiosity, delving into ctypes

Re: Alternatives to XML?

2016-08-24 Thread alister
On Wed, 24 Aug 2016 16:58:54 +0200, Frank Millman wrote: > Hi all > > I have mentioned in the past that I use XML for storing certain > structures 'off-line', and I got a number of comments urging me to use > JSON or YAML instead. > > In fact XML has been working very well for me, but I am looki

Re: importing down in code rather than at top of file.

2016-08-29 Thread alister
On Mon, 29 Aug 2016 10:57:22 -0700, Tobiah wrote: > Is it worth while to defer the import of a large module that seldom > gets used in the script? > > > import sys import os > > if hardly_ever_happens(): > > import large_module large_module.do_task() >

Re: *args and **kwargs

2016-09-02 Thread alister
On Fri, 02 Sep 2016 23:44:50 +1000, Ben Finney wrote: > Smith writes: > >> I'm trying to understand the concept of * args and ** kwarg with >> python3 > > Welcome. Your questions are fine in this forum; but you may also want to > participate in our collaborative learning forum for Python beginn

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-05 Thread alister
On Mon, 05 Sep 2016 08:15:42 +0200, Thomas 'PointedEars' Lahn wrote: > >> So Veek should be able to appease P.E. by calling himself 'Veek "David >> Smith" M'. > > That would not help. “Veek” might be (the transcription of) a given > name or a family name, but “Veek M” is not a real name. [Real

  1   2   3   4   5   6   7   8   >