Re: Removing matching items from a list?

2013-08-03 Thread Christian Gollwitzer
Hi Kevin, Am 04.08.13 02:38, schrieb kevin4f...@gmail.com: Sorry for the repeated messages. I have no idea why I have such a long time delay. My messages didn't appear until just now after a few minutes (thought I was having some issues). you are posting to newsgroups from the USENET. It is t

[argparse] mutually exclusive group with 2 sets of options

2013-08-03 Thread Francois Lafont
Hi, Is it possible with argparse to have this syntax for a script? my-script (-a -b VALUE-B | -c -d VALUE-D) I would like to do this with the argparse module. Thanks in advance. -- François Lafont -- http://mail.python.org/mailman/listinfo/python-list

Re: Removing matching items from a list?

2013-08-03 Thread Dave Angel
kevin4f...@gmail.com wrote: > > Would you also happen to know how I could set up a list that keeps track of > the removed sets? > Let's see, i think that makes 5 times you've asked the same question, counting the dups you apparently sent to the same person. Instead of writing all these mes

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-08-03 Thread Kevin Walzer
On 8/1/13 10:15 AM, Gilles wrote: I already have a static IP, so the issue is more that remote MTAs might not accept connections from MTAs running on users' PC instead of ISP's. For what it's worth, that hasn't been my experience. -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.c

Re: Can someone suggest better resources for learning sqlite3? I wanted to use the Python library but I don't know sql.

2013-08-03 Thread CM
ave tried sql.learncodethehardway but it isn't complete yet. I tired looking on stackoverflow's sql tag also but nothing much there. Can someone suggest me better resources for learning sql/sqlite3? There are a lot of nice small tutorials out there found by Googling. One resource that you mig

Re: Removing matching items from a list?

2013-08-03 Thread kevin4fong
On Saturday, August 3, 2013 5:36:42 PM UTC-7, kevin...@gmail.com wrote: > I have no idea why but I'm unable to post in my original thread so I made a > new one here. > > > > > > Thank you for the advice, everyone, especially Steven. It was really helpful > with the descriptions and steps. >

Re: Removing matching items from a list?

2013-08-03 Thread kevin4fong
I have no idea why but I'm unable to post in my original thread so I made a new one here. Thank you for the advice, everyone, especially Steven. It was really helpful with the descriptions and steps. Would you also happen to know how I could set up a list that keeps track of the removed sets?

Re: Removing matching items from a list?

2013-08-03 Thread Steven D'Aprano
On Sat, 03 Aug 2013 17:29:28 -0700, kevin4fong wrote: > Would you also happen to know how I could go about setting up a list > that keeps track of the removed sets? > > For example, if there were 4 a's removed, that would be one set. And the > list would be: > > ['a'] > > but if there was also

Re: Removing matching items from a list?

2013-08-03 Thread kevin4fong
Thank you, Steven, for the advice. It was really helpful with the descriptions and steps. Would you also happen to know how I could set up a list that keeps track of the removed sets? Let's say there's 4 a's taken out. The list would show: ['a'] But if there was also 4 j's in addition to the

Re: Removing matching items from a list?

2013-08-03 Thread kevin4fong
On Saturday, August 3, 2013 5:25:16 PM UTC-7, Steven D'Aprano wrote: > On Sat, 03 Aug 2013 19:06:05 -0400, Roy Smith wrote: > > > > > In article <51fd8635$0$3$c3e8da3$54964...@news.astraweb.com>, > > > Steven D'Aprano wrote: > > > > > >> 2) Then go through those initial letters, and pi

Re: Removing matching items from a list?

2013-08-03 Thread kevin4fong
On Saturday, August 3, 2013 1:12:55 PM UTC-7, kevin...@gmail.com wrote: > Basically, I'm trying to find out how to remove matching items from a list. > But there doesn't seem to be any information on how to go about doing this > specific function. > > > > For example, what I want is: > > >

Re: Removing matching items from a list?

2013-08-03 Thread kevin4fong
On Saturday, August 3, 2013 3:37:41 PM UTC-7, Steven D'Aprano wrote: > On Sat, 03 Aug 2013 13:12:55 -0700, kevin4fong wrote: > > > > > Basically, I'm trying to find out how to remove matching items from a > > > list. But there doesn't seem to be any information on how to go about > > > doing t

Re: Removing matching items from a list?

2013-08-03 Thread kevin4fong
On Saturday, August 3, 2013 3:37:41 PM UTC-7, Steven D'Aprano wrote: > On Sat, 03 Aug 2013 13:12:55 -0700, kevin4fong wrote: > > > > > Basically, I'm trying to find out how to remove matching items from a > > > list. But there doesn't seem to be any information on how to go about > > > doing t

Re: Removing matching items from a list?

2013-08-03 Thread Steven D'Aprano
On Sat, 03 Aug 2013 19:06:05 -0400, Roy Smith wrote: > In article <51fd8635$0$3$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano wrote: > >> 2) Then go through those initial letters, and pick out the ones equal >> to 4 (or should that be "four or more"?). > > Assuming my earlier hunc

Re: Removing matching items from a list?

2013-08-03 Thread kevin4fong
On Saturday, August 3, 2013 3:37:41 PM UTC-7, Steven D'Aprano wrote: > On Sat, 03 Aug 2013 13:12:55 -0700, kevin4fong wrote: > > > > > Basically, I'm trying to find out how to remove matching items from a > > > list. But there doesn't seem to be any information on how to go about > > > doing t

Re: Python 2.7.5 incompatible

2013-08-03 Thread Terry Reedy
On 8/3/2013 6:32 PM, Steven D'Aprano wrote: Hi Sofia, and welcome! On Sat, 03 Aug 2013 17:31:03 -0300, sofia prata wrote: I use the Windows 7 and i'm trying to install the Python 2.7.5, even though it's working, it says it not compatible. So then, i can't use other programs that depend upon t

Re: Removing matching items from a list?

2013-08-03 Thread Chris Angelico
On Sun, Aug 4, 2013 at 12:06 AM, Roy Smith wrote: > In article <51fd8635$0$3$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano wrote: > >> 2) Then go through those initial letters, and pick out the ones equal to >> 4 (or should that be "four or more"?). > > Assuming my earlier hunch is

Re: Removing matching items from a list?

2013-08-03 Thread Roy Smith
In article <51fd8635$0$3$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > 2) Then go through those initial letters, and pick out the ones equal to > 4 (or should that be "four or more"?). Assuming my earlier hunch is correct about these being cards in a deck, and the a's bein

Re: Removing matching items from a list?

2013-08-03 Thread Steven D'Aprano
On Sat, 03 Aug 2013 13:12:55 -0700, kevin4fong wrote: > Basically, I'm trying to find out how to remove matching items from a > list. But there doesn't seem to be any information on how to go about > doing this specific function. The documentation cannot possibly cover every single one of the inf

Re: Print word from list

2013-08-03 Thread Steven D'Aprano
On Sat, 03 Aug 2013 15:17:42 -0700, eschneider92 wrote: > pie='apple keylime pecan meat pot cherry' That sets pie to a string containing multiple words. > pie.split() This splits pie into individual words, then immediately throws the result away, leaving pie still set to a string. Instead, you

Re: Python 2.7.5 incompatible

2013-08-03 Thread Steven D'Aprano
Hi Sofia, and welcome! On Sat, 03 Aug 2013 17:31:03 -0300, sofia prata wrote: > I use the Windows 7 and i'm trying to install the Python 2.7.5, even > though it's working, it says it not compatible. So then, i can't use > other programs that depend upon the Python like the Google App Engine. > W

Re: Print word from list

2013-08-03 Thread eschneider92
Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Print word from list

2013-08-03 Thread Chris Angelico
On Sat, Aug 3, 2013 at 11:17 PM, wrote: > pie='apple keylime pecan meat pot cherry' > pie.split() > > How can I print a word from the list other than this way: print(pie[0:5]) ? The split() method returns a list, it doesn't change the original string. Try: pies = pie.split() print(pie[2]) Ch

Print word from list

2013-08-03 Thread eschneider92
pie='apple keylime pecan meat pot cherry' pie.split() How can I print a word from the list other than this way: print(pie[0:5]) ? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: Crawl Quora

2013-08-03 Thread Dave Angel
Umesh Sharma wrote: > Hello, > > I am writing a crawler in python, which crawl quora. I can't read the content > of quora without login. But google/bing crawls quora. One thing i can do is > use browser automation and login in my account and the go links by link and > crawl content, but this me

Re: Removing matching items from a list?

2013-08-03 Thread MRAB
On 03/08/2013 21:12, kevin4f...@gmail.com wrote: Basically, I'm trying to find out how to remove matching items from a list. But there doesn't seem to be any information on how to go about doing this specific function. For example, what I want is: let's say there is a list: pHands[0] = ['a

Re: Removing matching items from a list?

2013-08-03 Thread Roy Smith
In article <6c0bdea5-23bd-4854-8016-4bf0af3b7...@googlegroups.com>, kevin4f...@gmail.com wrote: > let's say there is a list: > > pHands[0] = ['ad', 'ac', 'as', 'ah', '7d', '8s', '9d', 'td', 'js', 'jd'] I assume this is a card game, and these are cards (ad = Ace of Diamonds, etc). > I'm trying

Re: Where to suggest improvements in the official Python documentation?

2013-08-03 Thread Terry Reedy
On 8/3/2013 2:23 PM, Joel Goldstick wrote: On Sat, Aug 3, 2013 at 1:53 PM, Aseem Bansal wrote: I have a suggestion about the Python tutorial for improvement. Specifically about in Python tutorial 4.7.5 lambda forms. http://docs.python.org/3/tutorial/controlflow.html#lambda-forms It is not very

Python 2.7.5 incompatible

2013-08-03 Thread sofia prata
I use the Windows 7 and i'm trying to install the Python 2.7.5, even though it's working, it says it not compatible. So then, i can't use other programs that depend upon the Python like the Google App Engine. What do i do? -- http://mail.python.org/mailman/lis

Re: Removing matching items from a list?

2013-08-03 Thread woooee
Use a dictionary to count the number of times each first letter appears, then place any first letters==4 in a list or set and remove any items that have a first letter in the list/set (or keep items that are not in the set which is probably faster if using list comprehension). -- http://mail.

Re: Removing matching items from a list?

2013-08-03 Thread kevin4fong
On Saturday, August 3, 2013 1:12:55 PM UTC-7, kevin...@gmail.com wrote: > Basically, I'm trying to find out how to remove matching items from a list. > But there doesn't seem to be any information on how to go about doing this > specific function. > > > > For example, what I want is: > > >

Removing matching items from a list?

2013-08-03 Thread kevin4fong
Basically, I'm trying to find out how to remove matching items from a list. But there doesn't seem to be any information on how to go about doing this specific function. For example, what I want is: let's say there is a list: pHands[0] = ['ad', 'ac', 'as', 'ah', '7d', '8s', '9d', 'td', 'js',

Re: Python: Code is ignoring the if and else

2013-08-03 Thread kevin4fong
On Friday, August 2, 2013 10:04:56 PM UTC-7, Terry Reedy wrote: > On 8/2/2013 10:24 PM, kevin4f...@gmail.com wrote: > > > > Looking at this again, I believe you actually had the structure almost > > right before. You want to look through *all* of the target players cards > > and if *none* of

Re: Can someone suggest better resources for learning sqlite3? I wanted to use the Python library but I don't know sql.

2013-08-03 Thread Cousin Stanley
Aseem Bansal wrote: > > Can someone suggest me better resources > for learning sql/sqlite3 ? http://docs.python.org/3/library/sqlite3.html http://wiki.python.org/moin/DbApiCheatSheet http://www.w3schools.com/sql/default.asp http://www.sqlcourse.com/index.html http://sqlite.org

Crawl Quora

2013-08-03 Thread Umesh Sharma
Hello, I am writing a crawler in python, which crawl quora. I can't read the content of quora without login. But google/bing crawls quora. One thing i can do is use browser automation and login in my account and the go links by link and crawl content, but this method is slow. So can any one tel

Re: Does Python 'enable' poke and hope programming?

2013-08-03 Thread Ethan Furman
On 08/03/2013 10:30 AM, CM wrote: But what I meant is that if one is writing a program, there is a way to **know**--without experimentation--what a particular set of code is going to do. Even when you /know/, experimenting is still good for two other purposes: - check that what you know i

Re: Can someone suggest better resources for learning sqlite3? I wanted to use the Python library but I don't know sql.

2013-08-03 Thread Joel Goldstick
On Sat, Aug 3, 2013 at 1:57 PM, Aseem Bansal wrote: > I was writing a Python script for getting the user stats of a > website(Specifically codereview.stackexchange). I wanted to store the stats > in a database. I found Python3's sqlite3 library. I found that I needed sql > commands for using it

Re: Can someone suggest better resources for learning sqlite3? I wanted to use the Python library but I don't know sql.

2013-08-03 Thread Vito De Tullio
Aseem Bansal wrote: > I have tried sql.learncodethehardway but it isn't complete yet. I tired > looking on stackoverflow's sql tag also but nothing much there. Can > someone suggest me better resources for learning sql/sqlite3? a start is the sqlite homepage: http://www.sqlite.org/docs.html --

Re: Where to suggest improvements in the official Python documentation?

2013-08-03 Thread Joel Goldstick
On Sat, Aug 3, 2013 at 1:53 PM, Aseem Bansal wrote: > I have a suggestion about the Python tutorial for improvement. Specifically > about in Python tutorial 4.7.5 lambda forms. > http://docs.python.org/3/tutorial/controlflow.html#lambda-forms > > It is not very clear from the tutorial what lambda

Can someone suggest better resources for learning sqlite3? I wanted to use the Python library but I don't know sql.

2013-08-03 Thread Aseem Bansal
I was writing a Python script for getting the user stats of a website(Specifically codereview.stackexchange). I wanted to store the stats in a database. I found Python3's sqlite3 library. I found that I needed sql commands for using it. I have tried sql.learncodethehardway but it isn't complete

Where to suggest improvements in the official Python documentation?

2013-08-03 Thread Aseem Bansal
I have a suggestion about the Python tutorial for improvement. Specifically about in Python tutorial 4.7.5 lambda forms. http://docs.python.org/3/tutorial/controlflow.html#lambda-forms It is not very clear from the tutorial what lambda forms are for someone who doesn't know functional programmin

Re: Does Python 'enable' poke and hope programming?

2013-08-03 Thread Chris Angelico
On Sat, Aug 3, 2013 at 6:30 PM, CM wrote: > In sum: experimentation is for when you don't know what you're doing and > there is no manual; but, after the initial learning time, you *should* know > what you're doing and you should have the manual handy, and therefore the > time for experimentat

Re: Does Python 'enable' poke and hope programming?

2013-08-03 Thread CM
Wayne, thanks for your thoughts. I am all for the scientific method--in understanding the natural world, which doesn't come with a manual. But Python is an artificial system designed by mere people (as well as Guido), and, as such, does have a manual. Ideally, there should be very little ne

Re: Minions are Python Powered!

2013-08-03 Thread CM
On Saturday, August 3, 2013 6:16:09 AM UTC-4, Borja Morales wrote: > Everytime I watched the minions from Despicable Me something was hitting my > unconscious mind. Finally I figured it out... Minions are Python Powered! > > > > I couldn't resist to make an image :) I haven't even seen either

Re: Python performance

2013-08-03 Thread Stefan Behnel
Wayne Werner, 03.08.2013 15:09: > On Fri, 2 Aug 2013, Schneider wrote: >> I have to write a small SMTP-Relay script (+ some statistic infos) and >> I'm wondering, if this >> can be done in python (in terms of performance, of course not in terms of >> possibility ;) ). >> >> It has to handle around

Re: Correct Way to Write in Python

2013-08-03 Thread Chris Angelico
On Sat, Aug 3, 2013 at 4:59 PM, Sagar Varule wrote: > Your explanation for private and public access modifier was awesome as I was > having harding time finding why we dont have access modifier for > pythonThanks a lot It's a huge saving in time and effort. The C++ convention is: Make every

Re: Correct Way to Write in Python

2013-08-03 Thread Sagar Varule
On Saturday, August 3, 2013 2:34:10 PM UTC+5:30, Peter Otten wrote: > Sagar Varule wrote: > > > > > On Saturday, August 3, 2013 12:17:49 PM UTC+5:30, Peter Otten wrote: > > >> punk.sa...@gmail.com wrote: > > > > > Thanks a lot Peter. I appreciate your Help. You mentioned that C# code > > >

Re: Correct Way to Write in Python

2013-08-03 Thread Sagar Varule
On Saturday, August 3, 2013 1:50:41 PM UTC+5:30, Steven D'Aprano wrote: > On Fri, 02 Aug 2013 23:18:47 -0700, punk.sagar wrote: > > > > > Hi All, > > > > > > Im new to Python. Im coming from C# background and want to learn Python. > > > I was used to do following thing in C# in my previous e

Re: LibreOffice

2013-08-03 Thread David Robinow
On Fri, Aug 2, 2013 at 9:26 PM, Terry Reedy wrote: > ... > Of relevance to this list, Libre Office upgraded the included Python > interpreter to 3.3. I have no idea whether OO is still using 2.3 or also > updated. They're up to 2.7 now. -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP8 revised: max line lengths

2013-08-03 Thread Roy Smith
In article , Chris Angelico wrote: > Sorry. Term I should have used is "base SI unit". Instead of using the > cm, use the m. Or go three orders of magnitude at a time to the km or > the mm. Or, go digital, and use Kim (kibimeters). -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP8 revised: max line lengths

2013-08-03 Thread Nicholas Cole
On Friday, 2 August 2013, Chris “Kwpolska” Warrick wrote: [snip] > > So, what are you feasting for? Nothing? I have long since ceased to be amazed at the number of people who would like their personal and arbitrary preferences, and the rationalisations that go with them, to be validated and en

Re:web development in python without using any webframework

2013-08-03 Thread jj
you could check the codes of flask ,bottle ,web.py to read codes ,the learn what you want to know . -- Original -- From: "Alok Singh Mahor"; Date: Sat, Aug 3, 2013 12:52 PM To: "python-list"; Subject: web development in python without using any webfram

Re: PEP8 revised: max line lengths

2013-08-03 Thread Chris Angelico
On Sat, Aug 3, 2013 at 3:21 AM, Joshua Landau wrote: > On 2 August 2013 22:34, Chris Angelico wrote: >> >> On Fri, Aug 2, 2013 at 10:15 PM, wrote: >> >> > Problem #3 >> > cm or inch? The only serious unit is an SI unit. >> > (In scientific publications, only SI units are accepted) >> >> The cm

Re: PyArg_ParseTuple() when the type could be anything?

2013-08-03 Thread Stefan Behnel
David M. Cotter, 03.08.2013 02:55: > I'd like to be able to use PyArg_ParseTuple() in a generic way. > > for example, i'd like to have all commands start with 1 integer parameter, > and this "commandID" will inform me of what parameters come next (via LUT). > > knowing that i can then call Parse

Re: Minions are Python Powered!

2013-08-03 Thread mm0fmf
Steven D'Aprano wrote: On Sat, 03 Aug 2013 03:16:09 -0700, Borja Morales wrote: Everytime I watched the minions from Despicable Me something was hitting my unconscious mind. Finally I figured it out... Minions are Python Powered! I couldn't resist to make an image :) https://www.dropbox.com/s

Re: Python performance

2013-08-03 Thread Wayne Werner
On Fri, 2 Aug 2013, Schneider wrote: Hi list, I have to write a small SMTP-Relay script (+ some statistic infos) and I'm wondering, if this can be done in python (in terms of performance, of course not in terms of possibility ;) ). It has to handle around 2000 mails per hour for at least 8h

Re: Logging help

2013-08-03 Thread Wayne Werner
On Thu, 1 Aug 2013, Joseph L. Casale wrote: I have a couple handlers applied to a logger for a file and console destination. Default levels have been set for each, INFO+ to console and anything to file. How does one prevent logging.exception from going to a specific handler when it falls within

Re: Does Python 'enable' poke and hope programming?

2013-08-03 Thread Wayne Werner
On Thu, 1 Aug 2013, CM wrote: (My subject line is meant to be tongue and cheek inflammatory) I've been thinking about why programming for me often feels like ice skating uphill. I think part of the problem, maybe the biggest part, is what now strikes me as a Very Bad Habit, which is "poke an

Re: Minions are Python Powered!

2013-08-03 Thread Steven D'Aprano
On Sat, 03 Aug 2013 03:16:09 -0700, Borja Morales wrote: > Everytime I watched the minions from Despicable Me something was hitting > my unconscious mind. Finally I figured it out... Minions are Python > Powered! > > I couldn't resist to make an image :) > > https://www.dropbox.com/s/t8kaba619vi

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-08-03 Thread Wayne Werner
On Thu, 1 Aug 2013, Gilles wrote: On Wed, 24 Jul 2013 10:38:52 -0400, Kevin Walzer wrote: Thanks. hMailServer was one of the apps I checked, and I was just making sure there weren't something simpler, considering my needs, ideally something like Mongoose MTA. Have you checked Kenneth Rietz's

Re: PEP8 79 char max

2013-08-03 Thread Wayne Werner
On Wed, 31 Jul 2013, Joshua Landau wrote: To explain, I tend to take the "HTML" form of alignment by wrapping: open stuff stuff stuff close to open     stuff     stuff     stuff close Depending on how much 'stuff' I have, I, for one, prefer a third: open stuff stuff stuff clo

Minions are Python Powered!

2013-08-03 Thread Borja Morales
Everytime I watched the minions from Despicable Me something was hitting my unconscious mind. Finally I figured it out... Minions are Python Powered! I couldn't resist to make an image :) https://www.dropbox.com/s/t8kaba619vi6q82/minion_powered_by_python_reality3d.jpg -- http://mail.python.org/

Re: Correct Way to Write in Python

2013-08-03 Thread Peter Otten
Sagar Varule wrote: > On Saturday, August 3, 2013 12:17:49 PM UTC+5:30, Peter Otten wrote: >> punk.sa...@gmail.com wrote: > Thanks a lot Peter. I appreciate your Help. You mentioned that C# code > above is not good. If you can point me why it is not good, would help me > learn new approaches as t

Re: Correct Way to Write in Python

2013-08-03 Thread Steven D'Aprano
On Fri, 02 Aug 2013 23:18:47 -0700, punk.sagar wrote: > Hi All, > > Im new to Python. Im coming from C# background and want to learn Python. > I was used to do following thing in C# in my previous experiences. I > want to know how do I implement below example in Python. How these > things are don

Re: Correct Way to Write in Python

2013-08-03 Thread Sagar Varule
On Saturday, August 3, 2013 12:17:49 PM UTC+5:30, Peter Otten wrote: > punk.sa...@gmail.com wrote: > > > > > Hi All, > > > > > > Im new to Python. Im coming from C# background and want to learn Python. > > > I was used to do following thing in C# in my previous experiences. I want > > > to