Re: Cookie issue(cant fix it with anyhting)

2013-10-27 Thread Denis McMahon
t's the counter). There's only one entry in the table for my system. I used the backlinks on each of the two pages above - the backlink on mythosweb.gr I used twice. So, whatever behaviour you're seeing is not what I'm seeing. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Error Testing

2013-10-31 Thread Denis McMahon
ght brothers?? No, but that's not what you said. What you said was that "the [FORTRAN] language [was] hacked together haphazardly." That's like me saying that when your uncle flies, he just pulls and pushes levers and knobs randomly hoping he doesn't crash - and that w

Re: Error Testing

2013-10-31 Thread Denis McMahon
On Thu, 31 Oct 2013 10:56:12 -0700, rusi wrote: > On Thursday, October 31, 2013 11:20:52 PM UTC+5:30, Denis McMahon wrote: >> On Thu, 31 Oct 2013 09:05:04 -0700, rusi wrote: >> > If I say: "My uncle knows more about flying planes than the Wright >> > brother

Re: Retrieving possible list for use in a subsequent INSERT

2013-11-01 Thread Denis McMahon
isits, downloads) ) I suspect the issue is that, as a list type, the pysql interface expects to map "downloads" to either multiple columns, or one column in multiple rows, ie it is expecting the list to deliver multiple data items to the database, but the database is looking for a sing

Re: Retrieving possible list for use in a subsequent INSERT

2013-11-02 Thread Denis McMahon
data once it is no longer needed. As an observation, if you are simply providing a torrent search engine, you do not need to log or record anything at all. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: How to add a current string into an already existing list

2013-11-02 Thread Denis McMahon
tter take that up with the mysql designers. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Automation

2013-11-03 Thread Denis McMahon
shell a peanut. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Automation

2013-11-04 Thread Denis McMahon
On Sun, 03 Nov 2013 23:32:46 +, Denis McMahon wrote: > On Sun, 03 Nov 2013 14:19:48 -0200, Renato Barbosa Pim Pereira wrote: > >> I have one .xls file with the values of PV MV and SP, I wanna to >> calculate Kp Ki Kd with python from this file, can anyone give me any >&

Re: How to add a current string into an already existing list

2013-11-04 Thread Denis McMahon
m for putting a list straight into a database, because mysql does not have a "collection" record type. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: How to add a current string into an already existing list

2013-11-05 Thread Denis McMahon
ed many times in the past, you should stop trying to write code. Seriously, how many other people do you see repeatedly posting "I don't understand the error, help" messages here that have been caused by such simple coding mistakes? Most of us can decipher these error messages

Re: Help me with this code PLEASE

2013-11-05 Thread Denis McMahon
and display the list contents, then do the same for list 2, then retrieve all the data from the db and reproduce each list in turn. Then you might be ready to try coding what you're trying to code. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Help me with this code PLEASE

2013-11-05 Thread Denis McMahon
On Tue, 05 Nov 2013 20:09:42 +0200, Nick the Gr33k wrote: > Denis, i have already provided my code trying to do what i need and i > need some commendation on how to make it work. Nick, you're obviously trying to code way above your abilities. If you want me to write your code, you w

Re: Help me with this code PLEASE

2013-11-05 Thread Denis McMahon
ut 6000 Gbytes a day from and to the database. Holy smoke batman, that's a lot of data. Or you could use the database properly, and just write the 40 byte torrent file name to the database with a pointer to the user's record every time a user downloads another torrent. -- Den

Re: Adding 'download' column to existing 'visitors' table (as requested)

2013-11-06 Thread Denis McMahon
inally give up trying to help you. I've had enough. You refuse to learn the right way to do it. You won't listen to the opinions and suggestions of people with a great deal more experience than you have in such matters. It's not going to work properly in the end. I refuse t

Re: Help with my programming homework (python, and raptor)

2013-11-06 Thread Denis McMahon
ate maximum salary = people receiving = similar for minimum I might have missed something from the original spec, but as I recall, you just wanted min, max and avg salaries, and to know who was getting the min and max, yes? -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.o

Re: To whoever hacked into my Database

2013-11-07 Thread Denis McMahon
On Wed, 06 Nov 2013 10:34:34 -0500, Joel Goldstick wrote: >> Okey let the hacker try again to mess with my database!!! > Nothing like a good challenge. I think the hacker is a figment of Nick's imagination, or rather a consequence of his broken python code corrupting his da

Re: To whoever hacked into my Database

2013-11-07 Thread Denis McMahon
cked, I'd guess it was most likely sql injection using a hand crafted get or post request that exploited some vulnerability that you have carelessly posted in an internet forum and then ignored advice to make secure. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: To whoever hacked into my Database

2013-11-08 Thread Denis McMahon
On Fri, 08 Nov 2013 01:28:19 +0200, Νίκος Αλεξόπουλος wrote: > If i was completely incompetent i wouldn't had a working website and i > wasn't able to design my customers' webpages. If your website is working, why do you keep posting here asking us how to fix it? -- Denis

Re: To whoever hacked into my Database

2013-11-08 Thread Denis McMahon
On Fri, 08 Nov 2013 01:10:37 +, Steve Simmons wrote: > I must say that I kinda like the idea of Nick's computer gagging on his > code and sending him messages pleading that he educated himself. It's a more likely scenario that Nick learning to code properly. -- Denis McMa

Re: datetime question

2013-11-08 Thread Denis McMahon
On Sat, 09 Nov 2013 00:01:37 +0200, Νίκος Αλεξόπουλος wrote: > I saw the link and i'm wondering if it can be written in 1-liner. Yes, but you have to rewrite all your code in perl to do this. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: datetime question

2013-11-11 Thread Denis McMahon
f DST happens? Yes, but the scarcity of universal whitespace is preventing me from posting it. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: requesting you all to please guide me , which tutorials is best to learn redis database

2015-02-28 Thread Denis McMahon
resumably an sql variant) used by the database, and a very good understanding of how string formatting works in python, as you'll be using python to build command strings to send to the database. Then you may be ready to start gluing the two together. -- Denis McMahon, denismfmcma...@gmail

Re: Md5 is different in Windows and Linux

2015-03-02 Thread Denis McMahon
ifference in value of Checksum computed by python in > windows and other system.? Perhaps windows file io is padding the file to the block size? Or maybe the windows version has different end of lines. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: A simple single line, triple-quoted comment is giving syntax error. Why?

2015-03-18 Thread Denis McMahon
hem. a = 5 '''text''' is just as wrong as: q = 4,5,6 [3,5,7,9] or k = 6-2 {56:91, 'fred': 'peter'} or even m = 62.3 56.7 101.2 -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: beautifulSoup 4.1

2015-03-20 Thread Denis McMahon
abbtd with the text of the next td for td in abbtds: print td.get_text(), td.find_next_sibling().get_text() This works for the html fragment example given, once I fixed it up by removing the extra at the end. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: beautifulSoup 4.1

2015-03-20 Thread Denis McMahon
On Fri, 20 Mar 2015 07:23:22 +, Denis McMahon wrote: > print td.get_text(), td.find_next_sibling().get_text() A slightly better solution might even be: print td.get_text(), td.find_next_sibling("td").get_text() -- Denis McMahon, denismfmcma...@gmail.com -- https://ma

Re: beautifulSoup 4.1

2015-03-20 Thread Denis McMahon
poses it's just whitespace) but in the dom the text node will contain the newline rather than a space. bs4 tries to parse the html the same way a browser does, so you get all the text nodes, including the whitespace between elements which includes any newlines. -- Denis McMahon, den

Re: Regex Python Help

2015-03-25 Thread Denis McMahon
On Tue, 24 Mar 2015 11:13:41 -0700, gdotoli wrote: > I am creating a tool to search a filesystem for one simple string. man grep STOP! REINVENTING! THE! WHEEL! Your new wheel will invariably be slower and less efficient than the old one. -- Denis McMahon, denismfmcma...@gmail.com -- ht

Re: Regex Python Help

2015-03-26 Thread Denis McMahon
On Wed, 25 Mar 2015 14:19:39 -0700, Gregg Dotoli wrote: > On Wednesday, March 25, 2015 at 4:36:01 PM UTC-4, Denis McMahon wrote: >> On Tue, 24 Mar 2015 11:13:41 -0700, gdotoli wrote: >> >> > I am creating a tool to search a filesystem for one simple string. >

Re: test1

2015-03-26 Thread Denis McMahon
ely internet vandalism, and your ongoing posts are simply trolling. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: test1

2015-03-26 Thread Denis McMahon
opic here. Hence its a pile of steaming excrement from a troll. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3 lack of support for fcgi/wsgi.

2015-03-30 Thread Denis McMahon
he wiki page on Web Programming <https://wiki.python.org/moin/WebProgramming> may be more in sync with recent development." -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3 lack of support for fcgi/wsgi.

2015-03-30 Thread Denis McMahon
aries and modules are Python 3 compatible, have a suitable caveat inserted, or be removed. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Error in processing JSON files in Python

2015-03-31 Thread Denis McMahon
fp will result in an invalid JSON file." Writing back to the same file as you read with json.load is the same thing. If you want to use the same file, you need to close it after the json.load(), and then open it again in write mode before the json.dump(). Write is "w", *NOT* "w+". -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: New to Programming: Adding custom functions with ipynotify classes

2015-04-03 Thread Denis McMahon
On Thu, 02 Apr 2015 18:30:42 -0700, Saran A wrote: > Here is the program that I am trying to write (with specs): Saran, please stop prefacing every subject with "New to programming:" - it does not give an clue whatsoever as to what your post is about. -- Denis McMahon

Re: Best search algorithm to find condition within a range

2015-04-07 Thread Denis McMahon
in the representation. He's making these and other similar errors in the javascript groups too. I suspect he's one of those people that spends his time thinking up elaborate solutions that he has no idea how to implement as a response to dreamt up non existent problems. -- Denis McMahon,

Re: Best search algorithm to find condition within a range

2015-04-08 Thread Denis McMahon
erratum > > *** 257 (base 10) --> 01 01 (base 256) *** Bt. Wrong. 0101(256) is 0 * 256^3 + 1 * 256^2 + 0 * 256^1 + 1 * 256^0 = 65537 The whole point of "base x" is that any number in the range 0 .. x^1 is represented with a single characterisation, otherwise you don

Re: Get nesting of regex groups

2015-04-08 Thread Denis McMahon
re patt = re.compile('(?Pa+(?Pb+))') result = patt.findall('abaabbaaabbb') print result however if all you are doing is using .search or .find for the first match of the pattern, then there should be no scope for confusion anyway. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Getting rid of

2015-04-12 Thread Denis McMahon
2 19:46 /usr/local/lib/python2.7/dist- packages/certifi/cacert.pem $ -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Getting rid of

2015-04-12 Thread Denis McMahon
On Sun, 12 Apr 2015 21:27:30 +0200, Cecil Westerhof wrote: > When you run my script you do not get warnings? I ran into too many issues trying to install the modules I needed to try and run it. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-25 Thread Denis McMahon
[0,1,2,3,4,5,6,7,8,9,10],[0,1,2,3,4,5,6,7,8,9,10])) And see what that produces. If the second plot produces the line I described, try: plot(zip(list(results.keys()), list(results.values()))) in your code. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-26 Thread Denis McMahon
ex data set. If, for example, you see a line from (1,11) to (5,5) instead of a line from (1,5) to (11,5), then it might be that you need to combine the two lists into a single list of co-ordinate tuples, using eg: plot(zip(list(results.keys()), list(results.values()))) -- Denis McMahon, den

Re: CHALLENGE HELP - GOOGLE DEVELOPER DAY

2015-05-06 Thread Denis McMahon
lve your problem. If the latter, and the code doesn't work, show us the code and we might be able to make suggestions for you. [1] If you thought getting Offler's Tears was hard, wait until you try reaching the altar of Cthulhu. -- Denis McMahon, denismfmcma...@gmail.com -- https

Re: Writing list of dictionaries to CSV

2015-05-06 Thread Denis McMahon
e same file. If excel recognises it's own csv exported dates, reformat your dates to match the excel ones when you generate the csv. Otherwise, you might need to convert the dates to a numeric value and tell excel to format the field as date after input. -- Denis McMahon, denismfmcma...@gm

Re: Encrypt python files

2015-05-08 Thread Denis McMahon
On Tue, 05 May 2015 23:37:02 -0700, Palpandi wrote: > What are the ways to encrypt python files? Depends why you want to encrypt them, and what you want to do with the encrypted files. Do you mean executable python code files, or do you mean data files generated by python. -- Denis McMa

Re: Encrypt python files

2015-05-08 Thread Denis McMahon
the code, it's impossible to hide the code at that point. Example - if I give you an encrypted binary to run on your system, it either has to be unencryptable using tools you already have, or using a built in unencrypter, both of which you have access to and can use to unencrypt th

Re: Beacon controller

2015-05-08 Thread Denis McMahon
On Tue, 05 May 2015 16:37:06 -0700, bmanogna.17 wrote: > I'm new to pyhton, can anyone suggest me how can I implement a DOS or > DDOS attack in Beacon Controller. Contact your nearest LEO cybercrime unit and ask them. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail

Re: Json Comaprision

2015-05-08 Thread Denis McMahon
ionaries if the sizes are equivalent too. Here's an example why: a = [ [a,b,c] ] b = [ [a,b,c], [a,c,b], [b,a,c], [b,c,a], [c,a,b], [c,b,a] ] If you compare sublists purely on the basis that they contain the same elements, then a[0] == each of b[0..5] Does that make a and b equa

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Denis McMahon
rocess, you could try using something like sed. sed -i.old 's/^\d+ : //' *.ext -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Rule of order for dot operators?

2015-05-17 Thread Denis McMahon
it, he's been a professional dick for years in php and javascript groups, and now he's obviously spreading himself further afield. He usually confines his wisdom to pointing out faults in other's posts, rather than offering any constructive input himself. -- Denis McMahon, denism

Re: Convert c file to csv file(unix format) in python

2015-05-19 Thread Denis McMahon
a csv file. Perhaps you could elaborate on these. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Convert c file to csv file(unix format) in python

2015-05-19 Thread Denis McMahon
output csv file is 1657 lines in length, and the first and last lines are: 16,0x0800,0xCC,0x16,0x00,0x20,0x35,0x15,0x00,0x08,0x29,0x15,0x00,0x08,0x2D,0x15,0x00,0x08 12,0x08006780,0x40,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xFF,0x00,0x00,0x00 -- Denis McMahon, denismfmcma...@gmail.com --

Re: Best approach to create humongous amount of files

2015-05-20 Thread Denis McMahon
r. You'll have a hard job creating a million files with timestamp based naming inside of an hour. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Convert c file to csv file(unix format) in python

2015-05-22 Thread Denis McMahon
On Wed, 20 May 2015 01:57:51 +, Denis McMahon wrote: > Based on the sample you sent, the output csv file is 1657 lines in > length, and the first and last lines are: [snip] Well he didn't tell me if I was generating the right output, or what was wrong with it if it was wrong, so

Re: Extract email address from Java script in html source using python

2015-05-25 Thread Denis McMahon
ry a less ambitious learning project. (b) Start reading the relevant documentation. Pick one and go with it. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Decoding JSON file using python

2015-05-28 Thread Denis McMahon
e is a json string, then data maps to a list / array data[0] maps to an object / dictionary data[0]["Message"] maps to the string literal "tdetails" data[0]["attr_name"] maps to a string representation of a json ob with another level of escaping. That string can then be loaded, eg: attr_name = json.loads(data[0]["attr_name"]) See: http:/www.sined.co.uk/python/nested_json.py.txt -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Decoding JSON file using python

2015-05-28 Thread Denis McMahon
On Wed, 27 May 2015 15:23:31 -0700, Karthik Sharma wrote: > The JSON structure is valid as shown by http://jsonlint.com/ Not when I paste it in it's not. The "data" attribute is an unterminated string and is not followed by a comma. -- Denis McMahon, denismfmcma...@g

Re: Logic problem: need better logic for desired thruth table.

2015-05-28 Thread Denis McMahon
oldown or (not (BotWaitForCooldown or > CooldownDetected)) Nope, it simplifies to: BotWaitForCooldown or not CooldownDetected -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Are there any other better ways to access a single bit of string of digits?

2015-05-31 Thread Denis McMahon
ulate them as numbers, not strings. def bing(n): n = int(n.replace("_", ""), base=16) # convert to numbers if n > 0x7fff:# if 0x8000 or more n = n + 0x0400# add 0x0400 return n # and retur

Re: What use for reversed()?

2015-05-31 Thread Denis McMahon
t() or create a list from reversed and then join the result: $ python Python 2.7.3 (default, Dec 18 2014, 19:10:20) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> "".join(list(reversed(&qu

Re: Where is 'palindrome' defined?

2015-06-01 Thread Denis McMahon
Now you also know that the error message: "NameError: name '' is not defined" means that you might have spelled differently on the line in the error message to the word you meant, so next time you see this error message you know to carefully check the spellings of function name

Re: What is considered an "advanced" topic in Python?

2015-06-01 Thread Denis McMahon
ng (IMO) basic python programming skills in doing so. I guess that makes OOP / classes the advanced topic in my system. I don't consider "using library x to do y" as advanced python, it's just gluing together existing functions with your own basic programming, no matter wheth

Re: How to inverse a particle emitter

2015-06-07 Thread Denis McMahon
e inside some simulation environment, then the best place to look is probably forums dedicated to that simulation environment. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: JSON Object to CSV file

2015-06-20 Thread Denis McMahon
> "CF": "Fee", Your json object seems to have the same key used for two elements at the same level, are you sure this is legal json? -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: JSON Object to CSV File Troubleshooting

2015-06-20 Thread Denis McMahon
go straight from XML to CSV, there is little added value in using some arbitrary intermediate format unless you're actually going to use the data in the intermediate format for something other than converting to the final format. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail

Re: JSON Object to CSV File Troubleshooting

2015-06-20 Thread Denis McMahon
en adequately describe it. At least, it seems that every time you do try and describe it either the data format or the task description changes. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: JSON Object to CSV file

2015-06-21 Thread Denis McMahon
On Sun, 21 Jun 2015 06:57:01 -0700, sahluwalia wrote: > On Sunday, 21 June 2015 02:47:31 UTC-4, Denis McMahon wrote: >> On Wed, 17 Jun 2015 08:00:11 -0700, Saran A wrote: >> >> > I would like to have this JSON object written out to a CSV file so >> > that the ke

Re: JSON Object to CSV File Troubleshooting

2015-06-21 Thread Denis McMahon
the problems that they face. > > I do agree with you Denis that this is an unconventional approach. I was > wondering then that perhaps I should add additional functionality at the > XML to JSON step? So far, with JSON objects without nested lists (as > values) I have been successful wi

Re: JSON Object to CSV File Troubleshooting

2015-06-21 Thread Denis McMahon
of what extracts from the XML are expected to be in which positions in the CSV. This is the sort of data conversion code I generally turn out in a day or so, it's hardly rocket science as long as you have a clear description of what is required. If you don't have a clear descrip

Re: JSON Object to CSV File Troubleshooting

2015-06-22 Thread Denis McMahon
g that object, but I don't see that generating you one line of CSV for each Int32 in MonthDayCount. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: enumerate XML tags (keys that will become headers) along with text (values) and write to CSV in one row (as opposed to "stacked" values with one header)

2015-06-26 Thread Denis McMahon
you later use the xml. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: enumerate XML tags (keys that will become headers) along with text (values) and write to CSV in one row (as opposed to "stacked" values with one header)

2015-06-28 Thread Denis McMahon
On Sun, 28 Jun 2015 09:46:36 +0200, Stefan Behnel wrote: > Denis McMahon schrieb am 26.06.2015 um 09:44: >> xml data is an unordered list, and are trying to assign an order to it. >> >> If the xml data was ordered, either each tag would be different, or >> each

Re: enumerate XML tags (keys that will become headers) along with text (values) and write to CSV in one row (as opposed to "stacked" values with one header)

2015-06-29 Thread Denis McMahon
On Sun, 28 Jun 2015 17:07:00 -0700, Ned Batchelder wrote: > On Sunday, June 28, 2015 at 5:02:19 PM UTC-4, Denis McMahon wrote: >> >> string 3 >> string 2 >> string 1 >> >> Each is just a member of the collection things, the xml does >> not

Re: "normalizing" a value

2015-07-01 Thread Denis McMahon
in your current code. Is this what you want? You could try the following: # step 1, limit x to the range -50 .. 50 if x < -50: x = -50.0 ix x >= 50: x = 50.0 # step 2, scale x to the range 0 .. 12 x = x * 0.12 + 6.0 If you want an integer value, you need to determine which method

Re: how to fix TypeError: format requires a mapping

2015-07-01 Thread Denis McMahon
ot;]""" % (row) > result_rows.append(formatted) > > print(',\n'.join(result_rows)) > > > clean_json(data) I assume you want the output as json. The solution may be to put the data into a suitable structure and dump the structure to json.

Re: Need assistance

2015-07-17 Thread Denis McMahon
able to a list. To join the elements of a list into a string, see the join method of strings. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Need assistance

2015-07-18 Thread Denis McMahon
On Sat, 18 Jul 2015 12:35:10 +0200, Sibylle Koczian wrote: > Am 18.07.2015 um 02:40 schrieb Denis McMahon: >> Having a list of words, get a copy of the list in reverse order. See >> the reversed function (and maybe the list function). > That won't really help, because the

flipping string order

2015-07-19 Thread Denis McMahon
On Sun, 19 Jul 2015 17:35:03 +0100, MRAB wrote: > rsplit -> one line. def lastWordFirst(s): return " ".join(reversed(s.rsplit(" ", 1))) -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: unexpected output while using list(and nested dictionary)

2015-07-22 Thread Denis McMahon
Ingress with a new single element list sg from makesg. I suspect you've refactored some code from processing a list of things inside a function to processing them in the main body, or vice versa, or have just got confused about what you're processing where. I suggest that you rename y

Re: Find Minimum for element in multiple dimensional array

2015-07-23 Thread Denis McMahon
put.csv", "wb") as f: writer = csv.writer(f) writer.writerows(tmp.values()) and lo: $ cat output.csv a,15 c,18 b,38 $ -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Logical Query JSON

2015-07-30 Thread Denis McMahon
to a database to see what comes out. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Logical Query JSON

2015-07-31 Thread Denis McMahon
too hard. You can construct the json query syntax fairly easily from python once you understand it: >>> import json >>> query = json.dumps( { "$and":[ { "$gt": {"age": 5} }, { "$not": {"name": "curly"} } ] } ) >>> query '{"$and": [{"$gt": {"age": 5}}, {"$not": {"name": "curly"}}]}' -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: AttributeError

2015-08-12 Thread Denis McMahon
unt.sort(reverse=True) print key,val ncount is a single key-value pair. Why are you trying to sort ncount? Do you want results ordered by count? First, change your dictionary into a list of tuples: ncount = [(a,c) for a,c in count.items()] Then sort ncount on the second field of the tuple: ncount

Re: AttributeError

2015-08-12 Thread Denis McMahon
rse the strings in the log file(s), incrementing counts[x] where x is the hour field of the timestamp. Then I'd create a list of tuples: ncounts = [(k,v) for k,v in counts.items()] sort it by the hour field: ncounts.sort(key = lambda x: x[0]) and print it: for x in ncounts: pr

Re: AttributeError

2015-08-12 Thread Denis McMahon
On Wed, 12 Aug 2015 09:29:50 -0700, Ltc Hotspot wrote: > Using the attached file of a diagram as a frame, why is there an > attribute message? Perhaps you should read the message. It's very clear. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/list

Re: AttributeError

2015-08-12 Thread Denis McMahon
can you please transfer to floor-scrubbing 101. [1] You have repeatedly ignored advice and instructions that you have been given. This is de-facto proof that you are not capable of learning to program computers. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: AttributeError

2015-08-12 Thread Denis McMahon
ours record always at position Y in the timestamp. c = [0 for i in range(24)] f = open(filename,'r') for l in f: h = int(l.strip().split()[X].split(':')[Y]) c[h] = c[h] + 1 f.close() for i in range(24): print '{:02d} {}'.format(i, c[i]) -- D

Re: AttributeError

2015-08-13 Thread Denis McMahon
commands of the actual text elements that you want to extract. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: AttributeError

2015-08-13 Thread Denis McMahon
e I posted may need the addition of a line something like: if line.startswith("From "): in a relevant position, as well as additional indenting to take account of that addition. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: How to model government organization hierarchies so that the list can expand and compress

2015-08-15 Thread Denis McMahon
bordinates' : ['army', 'navy', 'air force', 'jsoc'] }, 'navy' : { 'superiors' : ['jcs', 'nsa', 'cia'], 'subordinates' : ['seals', 'marines', 'pacific fleet' ] }, } The multiple parenting means that you need to use something as references. You can't represent the hierarchy as a simple tree, because in a simple tree a node only has one parent. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Can I download XML data from the web and save, in as CSV or TXT delimitation?

2015-08-19 Thread Denis McMahon
receiving and how the xml nodes and their attributes and values should be mapped into the csv file you want to create. Unfortunately I don't think that there is a single standard mechanism for doing that bit, although there are some tools and libraries that can help. -- Denis McMahon, denism

Re: How to compare lists

2015-09-01 Thread Denis McMahon
expect, you could come back here and post your code with a description of what you think it should do, what it actually does, and why you think that's wrong, and we'll try and help you fix. What we won't do is write your application from scratch. -- Denis McMahon, denismfmcma

Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread Denis McMahon
On Sun, 06 Sep 2015 23:23:14 +1000, Chris Angelico wrote: > WSGIScriptAlias / /path/to/scripts/MinstrelHall/mh.wsgi One wonders if the OP has mod_wsgi installed. https://code.google.com/p/modwsgi/wiki/WhereToGetHelp might be useful too. -- Denis McMahon, denismfmcma...@gmail.com -- ht

Re: python

2015-09-07 Thread Denis McMahon
On Sun, 06 Sep 2015 16:09:42 -0700, babi pepek wrote: > I wand update update There, now you have update. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Lesson 39 of Learning Python the Hard Way hangs

2015-09-09 Thread Denis McMahon
On Wed, 09 Sep 2015 20:45:57 +, John Gordon wrote: > In any case, I saved your code and ran it, and did not get an error. +1 I think "Execution Succesful!" might be coming from his IDE? -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Hi am new to python

2015-09-09 Thread Denis McMahon
= sum(list_a) print (s) And if you only want to display the answer: print (sum(list_a)) -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Context-aware return

2015-09-10 Thread Denis McMahon
x == func() Would you expect the last two calls to func() to return 999 or "Awesome"? Why? What is the material difference if any between interpreter (a) displaying the return value and (b) comparing the return value with another value. Debugging nightmare! -- Denis McMahon, den

Re: Random MAC generator error

2015-09-12 Thread Denis McMahon
esult: 00:16:3e:21:da:a4 00:16:3e:57:be:d2 00:16:3e:6b:e5:ae 00:16:3e:54:0e:f0 00:16:3e:57:5e:50 00:16:3e:21:99:6b 00:16:3e:12:e6:05 00:16:3e:53:02:6d 00:16:3e:79:17:1b 00:16:3e:02:ff:b8 00:16:3e:4e:ff:0d Observation: No point in declaring mac1 as global in the global scope. Is it possible that y

Re: How to use the returned telnet object after creating the telnet session.

2015-09-13 Thread Denis McMahon
> Now in the calling function If I use that object to read or write to > terminal I'm getting ERROR "AttributeError: 'NoneType' object has no > attribute 'read_very_eager'". My best guess would be that something failed and has returned None instead of

Re: convert element in a list to float

2015-09-13 Thread Denis McMahon
into a float, and (I think) should leave all others as they are. It users a helper function and a list comprehension. >>> def tofloat(x): ... try: ... return float(x) ... except ValueError: ... return None ... >>> l = [ '300', '"N"', '1140', '"E"' ] >>> l = [ tofloat(x) or x for x in l ] >>> l [300.0, '"N"', 1140.0, '"E"'] -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   >