Re: Howw to prevent the duplication of any value in a column within a CSV file (python)

2016-04-27 Thread darnold via Python-list
potential_passengers = ['bob','john','sue','wendy','chris','bob','jen','wendy'] accepted_passengers = set() for name in potential_passengers: print('checking on {}...'.format(name)) if name not in accepted_passengers: accepted_passengers.add(name) print('welcome aboard, {}

Re: How may I learn Python Web Frameworks

2015-07-24 Thread darnold via Python-list
you'll find a very extensive Flask tutorial at http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world . -- https://mail.python.org/mailman/listinfo/python-list

Re: Looking for direction

2015-05-20 Thread darnold via Python-list
I recommend getting your hands on "Automate The Boring Stuff With Python" from no starch press: http://www.nostarch.com/automatestuff I've not read it in its entirety, but it's very beginner-friendly and is targeted at just the sort of processing you appear to be doing. HTH, Don -- https://ma

Re: Running Python programmes

2013-10-29 Thread darnold
Maybe you're inadvertently running Python with either the '-i' switch or with the PYTHONINSPECT environment variable set? When you do that, your script will launch an interactive prompt after it completes. C:\Python27>echo print "hello" > hello.py C:\Python27>python hello.py hello C:\Python

Re: Parsing soap result

2013-04-17 Thread darnold
On Apr 17, 1:05 pm, Christian Heimes wrote: > Am 17.04.2013 19:55, schrieb darnold: > > > On Apr 17, 8:50 am, Ombongi Moraa Fe > > wrote: > > >> how do I use xml.etree.ElementTree to print the parameters address and > >> deliveryStatus? Or is there a bet

Re: Parsing soap result

2013-04-17 Thread darnold
On Apr 17, 8:50 am, Ombongi Moraa Fe wrote: > how do I use xml.etree.ElementTree to print the parameters address and > deliveryStatus? Or is there a better python method? > I'm sure there are prettier ways to do this, but you can use XPath syntax to find all of your ns1:result nodes and loop th

Re: a couple of things I don't understand wrt lists

2013-04-17 Thread darnold
On Apr 17, 5:25 am, aaB wrote: > > - the "complement" thing: > I haven't yet tried to reproduce this, but I will, and I will post back if I > see > this happening again, this time with a real log of python's interactive > console, > or a complete script which people can use. > That was happenin

Re: Python log parser

2013-04-05 Thread darnold
i know literally nothing about syslogs, but a google search for "python syslog parser" shows that some people have had success using the pyparsing module: http://www.j-schmitz.net/blog/how-to-parse-a-syslog-logfile-in-python https://gist.github.com/leandrosilva/3651640 hth, Don -- http://mail.py

Re: Issue with my code

2013-02-05 Thread darnold
On Feb 5, 4:05 pm, marduk wrote: > > Although that implementation also scans the string 10 times (s.count()), > which may not be as efficient (although it is happening in C, so perhaps > not). > > A better solution involves only scanning the string once. agreed. i was specifically showing how to

Re: Issue with my code

2013-02-05 Thread darnold
On Feb 5, 2:19 pm, maiden129 wrote: > How to reverse the two loops? > s=input("Enter a string, eg(4856w23874): ") checkS=['0','1','2','3','4','5','6','7','8','9'] for digit in checkS: t = s.count(digit) if t == 0: pass elif t == 1: print(digit,"occurs 1 time.") e

Re: Searching through two logfiles in parallel?

2013-01-08 Thread darnold
i don't think in iterators (yet), so this is a bit wordy. same basic idea, though: for each message (set of parameters), build a list of transactions consisting of matching send/receive times. mildly tested: from datetime import datetime, timedelta sendData = '''\ 05:00:06 Message sent - Va

Re: Trying to make a basic Python score counter in a game... will not count.

2012-12-17 Thread darnold
On Dec 16, 12:38 pm, tbg wrote: > Nice, will have to try it out... if you're interested in learning Python and/or game programming in Python, you might want to take a look at http://inventwithpython.com/ . HTH, Don -- http://mail.python.org/mailman/listinfo/python-list

Re: SQLAlchemy: How to do Table Reflection and MySQL?

2012-10-22 Thread darnold
On Oct 20, 6:24 pm, Nick Sabalausky wrote: > Hi, I'm fairly new to Python, and I'm trying to figure out how to use > SQLAlchemy to connect to a MySQL DB and use table reflection to set up > SQLAlchemy's tables. But the  SQLAlchemy documentation is gigantic and > frankly kinda making my head spin,

Re: which book?

2012-05-14 Thread darnold
On May 10, 4:58 am, d.po...@gmail.com wrote: > On Wednesday, May 9, 2012 7:13:54 AM UTC-7, Miki Tebeka wrote: > > > I am going to learn python for some plot issues. which book or sources, > > > do you recommend please? > > The tutorial is pretty good if you already know how to program. > > I also

Re: test for list equality

2011-12-15 Thread darnold
On Dec 15, 11:59 am, Miki Tebeka wrote: > > My sort issue... as in this doesn't work > > >>> if x.sort == y.sort: > > You're missing the () to make it a function call. > Also list.sort() returns none, it mutates the original list. > You can either >     sorted(x) == sorted(y) > or >     set(x) ==

Re: Methods on file-like objects can only used once on one object?

2011-08-23 Thread darnold
On Aug 23, 9:21 am, Yingjie Lin wrote: > Hi Python users, > > I just realize that my post yesterday shouldn't be specifically for > mechanize. It should be a general question for file-like objects. > > >>> f = open('my_file.txt') > >>> print f.readlines() > >         ( prints a list of strings>>>

Re: split long string in two code lines

2011-06-13 Thread darnold
print "this" \ " is" \ " a" \ " test" \ >>> RESTART >>> this is a test -- http://mail.python.org/mailman/listinfo/python-list