Re: Send array back in result from urllib2.urlopen(request, postData)

2014-01-10 Thread Denis McMahon
g in the php: echo $para; would become: echo php_json_encoding_function( para ); and in the python: para = result.read() would become: para = python_json_decoding_function( result.read() ) or possibly even: para = json.decode( result.read() ) (I don't know the details, I'm tr

Re: python first project

2014-01-11 Thread Denis McMahon
e system to do, what data they expect to input, and what data they expect to receive as outputs from it. Once you understand this, you may be in a position to start defining the database schema, and only then are you ready to think about the code that will put data into, and get it from, t

Re: Python example source code

2014-01-12 Thread Denis McMahon
requirements are. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: python adsl script

2014-01-14 Thread Denis McMahon
of tools out there that can be used to reset passwords on various operating systems. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Learning python networking

2014-01-15 Thread Denis McMahon
a json encoded string. You might decide that each message is simply going to end with a specific character or character sequence. Whatever you choose, you need some way for the receiving application to distinguish between individual messages in the stream of octets / bytes / characters that i

Re: Python solve problem with string operation

2014-01-16 Thread Denis McMahon
(len(a))if(n==0 or a[n-1]!=a[n])]) output = ''.join(b) If you really want to do it using just 'string' ops: for i in range(len(input)): if (i==0): output=input[0] elif input[i]!=input[i-1]: output+=input[i] -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Process datafeed in one MySql table and output to another MySql table

2014-01-16 Thread Denis McMahon
ch for mysql on the python docs website, or perhaps try googling "python mysql"? -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: python to enable javascript , tried selinium, ghost, pyQt4 already

2014-01-18 Thread Denis McMahon
sn't make a lot of sense (you'll be trading cpu in the client for cpu in the server + network bandwidth and latency). -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: python to enable javascript , tried selinium, ghost, pyQt4 already

2014-01-18 Thread Denis McMahon
basically impossible > without actually executing the JS code, which means largely replicating > the web browser. Oh, you think he meant scrape? I thought he was trying to scrap (as in throw away / replace) an old javascript heavy website with something using python instead. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Help with simple code that has database defined

2014-01-19 Thread Denis McMahon
idea fast. Or ask your lecturers for advice. Or return the advance you were paid on this coding job, because you don't seem to have the skills to do it. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Separate Address number and name

2014-01-22 Thread Denis McMahon
+)\s+(.*) The assumption is that it's not necessary to hold your hand through the whole looping through the input and applying the re to each line, then reading the captured bits and using them process. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Separate Address number and name

2014-01-22 Thread Denis McMahon
of a search, and the results of a split. I'm also assuming you're capable of working out how to use the csv module from the documentation. If you're not, then either go back and ask your lecturer for help, or tell your boss to hire a real programmer for his quick and easy coding jo

Re: Separate Address number and name

2014-01-23 Thread Denis McMahon
On Wed, 22 Jan 2014 17:35:22 +, Denis McMahon wrote: > On Tue, 21 Jan 2014 16:06:56 -0800, Shane Konings wrote: >> The following is a sample of the data. > A mechanism using regexes Just to follow up, using regexes I transformed the sample data that I believe is as follows

Re: Help with my 8-year old son's first program. I'm stuck!

2014-01-25 Thread Denis McMahon
tion a() Ignore the comment about needing to define the type of file on the first line on linux, it's a red herring. You only need to do that (and possibly chmod the file) on a *nix system if you want to execute it directly as a command, rather than by calling the interpreter on it. I suspect that if you remove the line: "def a():" and un-indent the rest of the text, the program will run just fine. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Need Help with Programming Science Project

2014-01-25 Thread Denis McMahon
author ] elif scores[ author ] == x: names.append( [ author ] ) print "the best matching author(s) is/are: ", names Then all you have to do is find enough ways to calculate stats, and the magic coefficients to use in the stat_weightings -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Lists inside dictionary and how to look for particular value

2014-01-26 Thread Denis McMahon
ement at the level you're trying to observe happens for the most part automatically at the ip stack / network hardware level. Do you think this database of which ip maps to which MAC is actually going to have some human use? If so, what? Or is this some sort of homework exercise as part of a programming course? -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Remove unwanted characters from column

2014-01-27 Thread Denis McMahon
en here: http://www.sined.co.uk/tmp/farms.txt http://www.sined.co.uk/tmp/farms.csv http://www.sined.co.uk/tmp/farms.htm -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: ANN: eGenix pyOpenSSL Distribution 0.13.3.1.0.1.6

2014-01-28 Thread Denis McMahon
t contain a backdoor that sends copies of all the plaintext to the NSA? -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Eclipse IDE printing values automatically

2014-01-29 Thread Denis McMahon
roblem, which is probably why the data you expect to be printed isn't being printed. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Large Two Dimensional Array

2014-01-29 Thread Denis McMahon
n either language, that value might need adjusting otherwise. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Help with some python homework...

2014-01-31 Thread Denis McMahon
paragraph describing what each line of the program does, you'll be on your way to understanding a few of the structures, syntaxes and mechanisms of python. Or you could show it to your lecturer or a TA and say it was suggested that you ask her or him to work through it with you.

Re: Help with some python homework...

2014-02-01 Thread Denis McMahon
e midnight, and then converting seconds back into hours, minutes and seconds. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Help with some python homework...

2014-02-01 Thread Denis McMahon
e Hence: discounted_price = list_price - discount_amount 0.6 * list_price = 1.0 * list_price - 0.4 * list_price so discounted_price = ( 1.0 - 0.4 ) * list_price where 0.4 is the decimal fraction of the discount -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Help with some python homework...

2014-02-02 Thread Denis McMahon
"price_per_book == (price_per_book * 1)" so rhs becomes (price_per_book * 1) - (price_per_book * percent_discount) and "(a * x) - (a * y)" == "a * (x - y)" so rhs becomes price_per_book * (1 - percent_discount) hence: discounted_price = price_per_book * (1 - percent_discount

Re: Calculator Problem

2014-02-02 Thread Denis McMahon
ink the while condition that leads to the function call is ever fulfilled anyway. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: [newbie] making rows of table with discrete values for different number systems

2014-02-03 Thread Denis McMahon
s=3 p=s*2 def b(n,x): s=[] while n: s.append(str(n%x)) n=n/x if s==[]: return "0" return ''.join(s[::-1]) for i in range(s**p): r=("{:0"+str(p)+"d}").format(int(b(i,s)))

Re: Calculator Problem

2014-02-03 Thread Denis McMahon
t;>>> That wasn't obtained from running the code you posted. Your code *as you posted it* gives: $ python charlie.py File "charlie.py", line 4 1 = float(input('First Number:')) SyntaxError: can't assign to literal $ -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: [newbie] troubles with tuples

2014-02-03 Thread Denis McMahon
g from the 0th element, up to and including the element preceding the first element Or [m:n] means starting from the mth element, everything up to and including the element preceding the nth element Are you sure you got (2,) for [0:1] and not for [2:3]? Are you sure your initial tuple is what

Re: What are the kinds of software that are not advisable to be developed using Python?

2014-02-08 Thread Denis McMahon
of software that are not advisable to be developed using Python? OS Kernels. Hardware drivers. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Screen scraper to get all 'a title' elements

2015-11-26 Thread Denis McMahon
) if 'class' in p.attrs] Then you can do this for thing in stuff: print thing (Python 2.7) This may be adaptable to your requirement. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: read 4D binary data

2015-11-26 Thread Denis McMahon
point (given by lat and lon) at that time. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: reading from a txt file

2015-11-26 Thread Denis McMahon
u define a string? Is it just a line with the spaces removed? >>> "".join("this is a teststring my friends".split(" ")) 'thisisateststringmyfriends' -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Help with this program???

2015-11-27 Thread Denis McMahon
name (first and last), student number, and mark out of 100 for each student; 4. Uses regular expressions or similar mechanisms to ensure the data appears valid. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: New JSON encoding method proposal for custom objects

2015-11-29 Thread Denis McMahon
nd secondly there's no mechanism in json that tells you what class of object you have. So you may have a __json_dumps__ that will dump your object out to a json string representation, but then how does json.loads recognise that it's loading your object to call your object's

Re: I can't understand re.sub

2015-11-29 Thread Denis McMahon
return 'hammer' if match == 'cat': return 'dog' if match == 'tree': return 'fence' return match with open("input.txt","r") as inf, open("output.txt","w") as ouf: line = inf.readline() line = patt.sub(replfunc, line) ouf.write(line) (also not tested) -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Could you explain this rebinding (or some other action) on "nums = nums"?

2015-12-01 Thread Denis McMahon
ts" or "license" for more information. >>> tup = [1,2,3],[4,5,6] >>> tup ([1, 2, 3], [4, 5, 6]) >>> tup[1] [4, 5, 6] >>> tup[1] += [7,8,9] Traceback (most recent call last): File "", line 1, in TypeError: 'tuple' object does not su

Re: Could you explain this rebinding (or some other action) on "nums = nums"?

2015-12-01 Thread Denis McMahon
On Tue, 01 Dec 2015 16:18:49 -0500, Terry Reedy wrote: > On 12/1/2015 3:32 PM, Denis McMahon wrote: >> On Tue, 01 Dec 2015 03:32:31 +, MRAB wrote: >> >>> In the case of: >>> >>> tup[1] += [6, 7] >>> >>> what it

Re: Could you explain this rebinding (or some other action) on "nums = nums"?

2015-12-01 Thread Denis McMahon
On Tue, 01 Dec 2015 14:44:38 -0600, Ian Kelly wrote: > On Tue, Dec 1, 2015 at 2:32 PM, Denis McMahon > wrote: >> On Tue, 01 Dec 2015 03:32:31 +, MRAB wrote: >> >>> In the case of: >>> >>> tup[1] += [6, 7] >>> >>> what it

Re: stuff and nonsense

2015-12-02 Thread Denis McMahon
ternet search engines because of the way newsgroups get gated to websites. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: stuff and nonsense

2015-12-02 Thread Denis McMahon
On Thu, 03 Dec 2015 01:46:44 +0100, Laura Creighton wrote: > In a message of Wed, 02 Dec 2015 22:51:13 +0000, Denis McMahon writes: >>On Wed, 02 Dec 2015 11:32:25 -0600, Ian Kelly wrote: >> >>> In what way is discussion of a tangential topic feeding the troll? &g

Re: filter a list of strings

2015-12-03 Thread Denis McMahon
] def isgood(item) for thing in badthings: if thing in item: return False return True -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to set several list elements a same value with one line code

2015-12-03 Thread Denis McMahon
e above three line codes are what I guess (I forgot the original > tutorial > now). Do you remember there is such a list application? bb = [ for i in range()] will create bb as a list of size whatever elements each of which is eg: >>> bb = [ ['a'] for i in range(4)] &g

Re: Python variable assigning problems...

2015-12-10 Thread Denis McMahon
you'd like to post a short self contained example of the problem here instead. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Why my image is in bad quality ?

2015-12-16 Thread Denis McMahon
idth*20,height*20), Image.ANTIALIAS) This appears to attempt to extrapolate 400 pixels from each pixel in the original image. That only works on TV crime dramas, you can't do it in real life. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: How does one distribute Tkinter or Qt GUI apps Developed in Python

2015-12-16 Thread Denis Akhiyarov
On Wednesday, December 16, 2015 at 6:45:50 PM UTC-6, Rick Johnson wrote: > On Wednesday, December 16, 2015 at 6:03:55 PM UTC-6, Bruce Whealton wrote: > > > Surely, one is going to want to create GUI apps for users > > that are not Python Developers. I would not think to ask > > someone to install

Re: Hangman Code.

2015-12-17 Thread Denis McMahon
variable value to prompt for the next player. After each player takes a turn, add 1 to the current player. If this is greater than the number of players, set it back to 1. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-20 Thread Denis McMahon
udent on this course, perhaps they are setting exercises for which they have not previously provided the necessary tuition. If that is the case, I suggest you ask them to reimburse your course fees, and then go and find better tutors. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: What could cause a plot fail in my code?

2015-12-22 Thread Denis McMahon
nd you've managed to reach line 6194 without going through that block. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: return from function

2015-12-22 Thread Denis McMahon
turn statement might help in returning a value. When you recurse back into a function you still need to return the result of the recursion. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Converting py files to .exe and .dmg

2015-12-28 Thread Denis McMahon
ython interpreter on the machine they wish to execute them on. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Newbie: Check first two non-whitespace characters

2015-12-31 Thread Denis McMahon
x != ''][0:3] == ['(', '(', '(']: # string starts '(((' -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Considering migrating to Python from Visual Basic 6 for engineering applications

2016-02-19 Thread Denis Akhiyarov
On Wednesday, February 17, 2016 at 1:49:44 PM UTC-6, wrong.a...@gmail.com wrote: > I am mostly getting positive feedback for Python. > > It seems Python is used more for web based applications. Is it equally fine > for creating stand-alone *.exe's? Can the same code be compiled to run on > Linux

Re: Considering migrating to Python from Visual Basic 6 for engineering applications

2016-02-22 Thread Denis Akhiyarov
Note that you can continue using your existing vb6 code from python through COM using pywin32 or pythonnet, until you decide to rewrite it. -- https://mail.python.org/mailman/listinfo/python-list

Inception

2016-03-02 Thread Denis Akhiyarov
Is it possible to embed CPython in CPython, e.g. using ctypes, cffi, or cython? -- https://mail.python.org/mailman/listinfo/python-list

Re: Inception

2016-03-02 Thread Denis Akhiyarov
Embed using C-API from ctypes, cffi or cython, but not using subprocesses. Thanks for asking! Here is link to official documentation about embedding: https://docs.python.org/3.6/extending/index.html -- https://mail.python.org/mailman/listinfo/python-list

Re: Inception

2016-03-03 Thread Denis Akhiyarov
restriction in CPython? On Thursday, March 3, 2016 at 2:10:15 AM UTC-6, Christian Gollwitzer wrote: > Hi Denis, > > Am 03.03.16 um 06:01 schrieb Denis Akhiyarov: > > Is it possible to embed CPython in CPython, e.g. using ctypes, cffi, or > > cython? > > > > sinc

Re: I am out of trial and error again Lists

2014-10-22 Thread Denis McMahon
ne. As I said above, getting your head round why this is happening is essential, and I really do suggest that you slow down and try and understand these basic concepts, because at the moment it seems you are striving to attempt more and more complicated things without understanding the basics upon which they are constructed, and like many other similar newsgroups, it's been my experience in the past that there is limited tolerance here for people who repeatedly make the same basic errors without learning from them. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: I am out of trial and error again Lists

2014-10-23 Thread Denis McMahon
s: a) The input you actually gave it isn't the input you thought you gave it b) You didn't read the description of the function, and it doesn't in fact do what you thought c) Both a and b above -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: I am out of trial and error again Lists

2014-10-23 Thread Denis McMahon
On Wed, 22 Oct 2014 19:11:51 -0400, Seymore4Head wrote: > On Wed, 22 Oct 2014 22:43:14 + (UTC), Denis McMahon > wrote: > >>On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: >> >>> def nametonumber(name): >>> lst=[""] >>>

Re: I am out of trial and error again Lists

2014-10-23 Thread Denis McMahon
On Thu, 23 Oct 2014 10:04:56 -0400, Seymore4Head wrote: > On Thu, 23 Oct 2014 09:15:16 + (UTC), Denis McMahon > wrote: >>Try the following 3 commands at the console: You obviously didn't, so I'll try again. Try each of the following three commands in the python conso

Re: I am out of trial and error again Lists

2014-10-23 Thread Denis McMahon
code written for codeskulptor outside of the codeskulptor environment. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Truthiness

2014-10-23 Thread Denis McMahon
falsey - empty set) "" (falsey - empty string) [""] (truthy - non empty set) [0] (truthy - non empty set) -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: I am out of trial and error again Lists

2014-10-24 Thread Denis McMahon
ght that would work in Python 3. It > didn't. It does if you enter it properly. also try: str(list(range(10))) Note that that has three "(" and three ")" on the line. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: I am out of trial and error again Lists

2014-10-24 Thread Denis McMahon
are "0" and "1" To recreate the python2 behaviour in python 3, use: str(list(range(10))) which gives '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]' howver the test: if x.isdigit(): is much better. But finally, with your telephone number decoder, look at: http:

Re: I am out of trial and error again Lists

2014-10-24 Thread Denis McMahon
On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote: > Thanks everyone for your suggestions. Try loading the following in codeskulptor: http://www.codeskulptor.org/#user38_j6kGKgeOMr_0.py -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: I am out of trial and error again Lists

2014-10-24 Thread Denis McMahon
iscovering the difference between the python2 and python3 range() functions, and what happens when you encapsulate them in string. I've already posted about this once this evening. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: I am out of trial and error again Lists

2014-10-24 Thread Denis McMahon
hat makes it easier to read. I > changed treating all " -()" With a space. > I am still thinking about how to treat the large space if it is a digit > instead: > 1 800 555 Note that my decoder assumes anything other than a letter can be copied straight to the output

Re: I am out of trial and error again Lists

2014-10-24 Thread Denis McMahon
to the full list of possible values, so str(list(range(10))) is a string representation of the list containing the values that the iterable range(10) creates. Note that whether you're looking at a string representation of a value or the value itself is a lot clearer in the interpreter console where s

Re: I am out of trial and error again Lists

2014-10-24 Thread Denis McMahon
the numbers yielded by the iterable a, none of them match because character "8" is not the same as number 8 When you try and compare a character x eg "8" with the elements of the list b, none of them match because character "8" is not the same as number 8 Wh

Re: I am out of trial and error again Lists

2014-10-25 Thread Denis McMahon
On Sat, 25 Oct 2014 15:01:54 +, Grant Edwards wrote: > On 2014-10-24, Denis McMahon wrote: >> On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote: >> >>> Thanks everyone for your suggestions. >> >> Try loading the following in codeskulpto

Re: I am out of trial and error again Lists

2014-10-25 Thread Denis McMahon
> print (b[1]) b[1] is the number 1 > if name[1] == b[1]: > print ("Eureka!") This didn't happen > else: > print ("OK, I get it") This happened -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: id == vs is

2014-10-26 Thread Denis McMahon
On Sun, 26 Oct 2014 17:12:29 -0700, Dan Stromberg wrote: > Are the following two expressions the same? > > x is y > > Id(x) == id(y) No, although if "Id" and "id" were the same function, they might be equivalent in some cases. -- Denis McMahon,

Re: Anyone know the solution

2014-10-27 Thread Denis McMahon
at, but I'm not sure from your problem description if that's your definition of a "most popular name" or not. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: A bug?

2014-10-27 Thread Denis McMahon
ppend' & do my job (less elegantly though). Not sure if this is elegant or not: d = [[list(range(1,13))[i*3+j] for j in range(3)] for i in range(4)] but it seems to be a one-line solution for what you're trying to do. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: A bug?

2014-10-28 Thread Denis McMahon
On Tue, 28 Oct 2014 01:29:28 +, Joshua Landau wrote: > On 28 October 2014 00:36, Denis McMahon > wrote: >> >> d = [[list(range(1,13))[i*3+j] for j in range(3)] for i in range(4)] > > A quick note. Ranges (even 2.7's xrange) are all indexable. The cast to >

Re: memory, PE files, etc...

2014-10-28 Thread Denis McMahon
ry common request. Does anyone know why? -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Anyone know the solution

2014-10-29 Thread Denis McMahon
ing how to code this. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Style Question

2014-10-30 Thread Denis McMahon
return int(tmp.group(1)) tmp = patt2.match(x) if tmp: return int(tmp.group(1)) return None a = [] for n in l: a.append(getTheInt(n)) print a # end of code prints: [1, -1, 0, 2, 2, -2, 0, 3, 3, -3, 0, -4, 4, 0, None, None, None, None, None, None, None, None, None, None, None] I know re matching the strings may be overkill, but it may be the best way of checking that the string contains the expected character format to convert to an int. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Classes

2014-11-02 Thread Denis McMahon
dth to enforce squareness upon the square. All the other methods of rectangle will work equally well for the square. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Classes

2014-11-02 Thread Denis McMahon
On Sun, 02 Nov 2014 21:32:13 +1100, Tim Delaney wrote: > On 2 November 2014 20:50, Denis McMahon > wrote: > >> The question (I thought) was to write a class for Square that inherited >> a class Rectangle but imposed on it the additional constraints of a >> square ov

Re: Classes

2014-11-02 Thread Denis McMahon
On Sun, 02 Nov 2014 11:31:12 -0500, Dennis Lee Bieber wrote: > On Sun, 2 Nov 2014 12:27:06 + (UTC), Denis McMahon > declaimed the following: > >>On Sun, 02 Nov 2014 21:32:13 +1100, Tim Delaney wrote: >>> If course, that's probably because rectangles have a m

Re: Classes

2014-11-03 Thread Denis McMahon
On Mon, 03 Nov 2014 06:29:39 +, Dan Sommers wrote: > On Mon, 03 Nov 2014 03:12:32 +0000, Denis McMahon wrote: > >> Quadrilateral >> Parallelogram >> Square Rectangle Rhombus Diamond (4 sides eq) >> Trapezoid >> Arrowhead > &g

Re: generating unique variable name via loops

2014-11-04 Thread Denis McMahon
, you should have had sufficient instruction in the relevant algorithms and language features to be able to figure it out yourself. In either case, what not explain what you tried, what you expected it to do, and what it actually did. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: generating unique variable name via loops

2014-11-04 Thread Denis McMahon
On Tue, 04 Nov 2014 05:53:04 -0800, Fatih Güven wrote: > Call employee1.name or employee2.salary and assign it to a new variable, > something etc. 1) Put the file into a database. 2) database calls -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/

Re: I need algorithm for my task

2014-11-05 Thread Denis McMahon
assume the first word ends when the letter that started it is found again. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: [OFF-TOPIC] It is true that is impossible write in binary code, the lowest level of programming that you can write is in hex code?

2014-11-05 Thread Denis McMahon
On Tue, 04 Nov 2014 21:30:06 -0500, Dennis Lee Bieber wrote: > If you have an old system with front-panel toggle switches, you set the > switches for binary values, and then push the "enter" switch. You've booted a PDP-8 then ;) -- Denis McMahon, denismfmcma..

Re: I need algorithm for my task

2014-11-05 Thread Denis McMahon
ord bar dib python DOLORIUM HELLOL thewordword barbaz dibdibdob $ I wonder which of these three is actually the algorithm the OP wants. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: I need algorithm for my task

2014-11-05 Thread Denis McMahon
uestions without showing the solutions to the students. I'm quite proud of a 2 line solution to the third algorithm that I implemented, although it might be considered as somewhat obfuscated code by some. ;) -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: I need algorithm for my task

2014-11-05 Thread Denis McMahon
On Thu, 06 Nov 2014 03:36:40 +, Denis McMahon wrote: > On Wed, 05 Nov 2014 18:49:01 +, MRAB wrote: > >> It doesn't work for the final example or "barbaz". > > Oh, and we really need a private "python homework answers" list where we > can d

Re: I need algorithm for my task

2014-11-05 Thread Denis McMahon
On Thu, 06 Nov 2014 15:14:05 +1100, Chris Angelico wrote: > On Thu, Nov 6, 2014 at 3:00 PM, Denis McMahon > wrote: >> def baseword(s): >> """find shortest sequence which repeats to generate s""" >> return s[0:["".join([s[0:x

Re: How do i reduce this to a single function - the code is largely similar, just a direction of search toggle.

2014-11-07 Thread Denis McMahon
self.w.cursor = row, new_col > > There's also the different methods index vs rindex. yes, those fall under point 2 of my earlier post. "something" and "something else" would be the complete means of calculating the value to assign to variable. -- Deni

Re: How do i reduce this to a single function - the code is largely similar, just a direction of search toggle.

2014-11-07 Thread Denis McMahon
bit trickier, the best I came up with was: while direction and condition_a or (not direction) and condition_b But I'm sure someone has something better -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: I don't read docs and don't know how to use Google. What does the print function do?

2014-11-10 Thread Denis McMahon
ng software engineers do need to do, so it sounds as if you'd be better off signing up with an escort agency. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Denis McMahon
thon+http+request and perhaps http://www.lmgtfy.com/?q=python+parse+html Personally I think last time I wanted to do we scraping in python I used requests and beautifulsoup, but ymmv. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: What is ?s here?

2014-11-11 Thread Denis McMahon
On Tue, 11 Nov 2014 01:37:21 -0800, satishmlmlml wrote: > What does ?s do in the following piece of code? It tells you to learn about regex. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: What is \1 here?

2014-11-11 Thread Denis McMahon
On Tue, 11 Nov 2014 01:18:02 -0800, satishmlmlml wrote: > What does \1 do in the following piece of code(fourth line)? It tells you to learn about regex. http://www.pcre.org/pcre.txt -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Python script that does batch find and replace in txt files

2014-11-11 Thread Denis McMahon
On Sun, 09 Nov 2014 11:58:49 -0800, Syed Khalid wrote: > Python script that does batch find and replace in txt files Need a > python script that opens all .txt files in a folder find replace/delete > text and save files. Sounds like you need sed, not python. -- Denis McMahon, de

Combining lists to dictionary

2014-11-11 Thread Denis McMahon
method to create a list of tuples just to split them up into key:value pairs. However the zip method handles the inequal length list problem. Granted it would probably be advisable to check that x and y are the same length before starting anyway. -- Denis McMahon, denismfmcma...@gmail.com

Re: Curious function argument

2014-11-12 Thread Denis McMahon
if the function modifies the object (e.g. by appending an item to a list), the default value is in effect modified. [1] ie when the function is 'compiled', not each time it executes. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: caught in the import web again

2014-11-15 Thread Denis McMahon
y trying to import and what the complete error messages are. For example, are these imports of code that you've written yourself, or part of the standard library modules, or third party modules. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   >