Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Rob Day
On 08/10/13 07:17, Chris Angelico wrote: Who's up for some fun? Implement an XKCD-936-compliant password generator in Python 3, in less code than this: print(*__import__(random).sample(open(/usr/share/dict/words).read().split(\n),4)) print(imploring epsilon decamp graveyard's) # Chosen by

Re: Strange files??

2013-04-10 Thread Rob Day
On Wednesday 10 Apr 2013 14:16:23 Joe Hill wrote: Recently I installed Python 3.3 successfully. Yesterday - I have a bunch of PY files such as thesaurus.py, some *.p7s files, some signature files and an index.fpickle. A total of 23 files. Where do they come from and how do they end up as

Re: Required arguments in argparse: at least one of a group

2013-03-23 Thread Rob Day
I don't know about argparse, but if you use docopt (http://docopt.org/) then this is easy to do with something like: Usage: finder.py --file myfile --dir mydir finder.py --pattern mypattern --dir mydir finder.py --file myfile --pattern mypattern --dir mydir On 23 March 2013 16:04, Marco

Re: need for help

2013-03-01 Thread Rob Day
It looks like you're using single underscores, not double: the methods should be __init__ and __str__. On 1 March 2013 18:35, leonardo selmi l.se...@icloud.com wrote: hi guys i typed the following program: class ball: def _init_(self, color, size, direction): self.color = color

Re: pyrudp

2013-01-30 Thread Rob Day
Have you seen http://pyraknet.slowchop.com/? It appears to do a similar thing. On 30 January 2013 17:02, Jorge Alberto Diaz Orozco jaoro...@estudiantes.uci.cu wrote: I´ve tried it but it´s not reliable. Datagrams can arive disorganised or just not arive. Some programmers said I most use TCP,

Re: WLAN tester

2013-01-28 Thread Rob Day
On 28 January 2013 17:07, Wanderer wande...@dialup4less.com wrote: Yes. I noticed this variability. I've been using the Totusoft Lan_Speedtest.exe to test some modules. I've tested through the wifi to our intranet and saw variations I believe do to network traffic. I also tried peer to peer

Re: Dict comp help

2013-01-24 Thread Rob Day
On 24 January 2013 21:11, Oscar Benjamin oscar.j.benja...@gmail.com wrote: l = [{'a': 'xx', 'b': 'yy', 'c': 'zz'}, {'a': 'dd', 'b': 'ee', 'c': 'ff'}] dict(d.values()[:2] for d in l) {'xx': 'zz', 'dd': 'ff'} Python doesn't guarantee any ordering of items in a dictionary; {'a': 'xx', 'b': 'yy',

Re: sqlite3 puzzle

2013-01-15 Thread Rob Day
On 15 January 2013 07:09, llanitedave llanited...@veawb.coop wrote: So I put the following test code in my initialization method: # open database file self.geologger_db = sqlite3.connect('geologger.mgc') self.db_cursor = self.geologger_db.cursor() self.foreign_key_status =

Re: sqlite3 puzzle

2013-01-15 Thread Rob Day
On 15 January 2013 15:51, llanitedave llanited...@veawb.coop wrote: Thanks for the suggestion, Rob, but that didn't make any difference. I've never had an issue with putting the execute object into a variable and calling fetch on that variable. I can accept reality if it turns out that

Re: sqlite3 puzzle

2013-01-15 Thread Rob Day
the changes were. /evangelism On 15 January 2013 20:29, llanitedave llanited...@veawb.coop wrote: On Tuesday, January 15, 2013 9:13:13 AM UTC-8, Rob Day wrote: On 15 January 2013 15:51, llanitedave llanited...@veawb.coop wrote: Thanks for the suggestion, Rob, but that didn't make any

Re: Unittest - testing for filenames and filesize

2012-08-26 Thread Rob Day
On Sun, 2012-08-26 at 10:36 -0700, Tigerstyle wrote: self.assertEqual(statinfo.st_size, filesize) I'm still getting AssertionError and the error says: 100 !=b' filesize is the character 'b' repeated one million times (the contents of the file, in other words).

Re: help with simple print statement!

2012-08-24 Thread Rob Day
On Fri, 2012-08-24 at 12:43 -0700, Willem Krayenhoff wrote: Any idea why print isn't working here? You're using Python 3.2, but trying Python 2.7 syntax - http://docs.python.org/release/3.0.1/whatsnew/3.0.html#print-is-a-function should explain the problem adequately. (Incidentally - you can

Re: [CGI] Why is HTML not rendered?

2012-08-17 Thread Rob Day
On 17 August 2012 14:27, Gilles nos...@nospam.com wrote: print Content-Type: text/plain;charset=utf-8 print Here's the problem - you're telling the browser to display in plain text. Try 'text/html' instead. -- Robert K. Day robert@merton.oxon.org --

Re: how to call perl script from html using python

2012-08-16 Thread Rob Day
On 16 August 2012 08:23, Pervez Mulla mullaper...@gmail.com wrote: In HTml when user submit POST method, it calling Python code Instead of this I wanna call perl script for sign up .. Can you not just change the action= attribute in your form HTML attribute to point to your Perl CGI

Re: A difficulty with lists

2012-08-15 Thread Rob Day
The list nlist inside of function xx is not the same as the variable u outside of the function: nlist and u refer to two separate list objects. When you modify nlist, you are not modifying u. http://mail.python.org/mailman/listinfo/python-list Well - that's not quite true. Before calling

Re: Sharing code between different projects?

2012-08-13 Thread Rob Day
I'd just create a module - called shared_utils.py or similar - and import that in both projects. It might be a bit messy if there's no 'unifying theme' to the module - but surely it'd be a lot less messy than your TempDirectory class, and anyone else who knows Python will understand 'import