Re: Pyscripter Issues

2016-03-31 Thread John Gordon
bit version. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- https://mail.python.org/mailman/listinfo/python-list

Re: Python path and append

2016-04-25 Thread John Gordon
en rename it afterwards, instead of rewriting the original file. import os f_in = open('win.txt', 'r') f_out = open('win_new.txt', 'w') for line in f_in.read().splitlines(): f_out.write(line + " *\n") f_in.close() f_

Re: Simplest way to locate a string in a column and get the value on the same row in another column

2016-04-28 Thread John Gordon
ething else? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.5.1 Not Working

2016-05-13 Thread John Gordon
ion 3.4.3 if you are using Windows XP. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- https://mail.python.org/mailman/listinfo/python-list

Re: Program prints questions for user input, but won't show the answer output

2016-05-18 Thread John Gordon
ounter < 7: > if (pints[counter] < lowPints): > lowPints = pints[counter] > counter = counter + 1 > return lowPints And getLow() has a very similar problem. I suspect you want to unindent the 'counter = counter + 1' statement so that it is NOT insid

Re: ZipImportError: can't find module

2016-05-24 Thread John Gordon
ob? Are the permissions on the zipfile correct, and all parent directories? How, specifically, are you importing the module? Are you doing something like this: zipfile = zipimport.zipimporter('file.zip') zipfile.load_module('mymodule') -- John Gordon

Re: Unit test a class with xml elements

2016-05-24 Thread John Gordon
here. > Share if any examples available. Create your own sample XML illustrating each desired combination. Then write test cases for each. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for B

Re: why it is like stop running after a 3 seconds

2016-06-09 Thread John Gordon
he function, but the recursive calls aren't inside that if block. DFS keeps calling itself with smaller and smaller values of deep. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: how to solve memory

2016-06-10 Thread John Gordon
In <4f853aa2-cc00-480b-9fd7-79b05cbd4...@googlegroups.com> meInvent bbird writes: > https://drive.google.com/file/d/0Bxs_ao6uuBDULVNsRjZSVjdPYlE/view?usp=sharing I already responded to your earlier post about this program. Did you read it? -- John Gordon A is for

Re: how to solve memory

2016-06-10 Thread John Gordon
ur name changed in previous post? My comment was that the recursive calls weren't indented in the "if deep > 0" block, therefore DFS was being called infinitely with smaller and smaller values of deep. But it appears you have fixed that issue. -- John Gordon

Re: log file.

2016-06-14 Thread John Gordon
g for help with logging, or communicating with the pump? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- https://mail.py

Re: how to for loop append a list [] when using parallel programming

2016-06-15 Thread John Gordon
In meInvent bbird writes: > how to for loop append a list [] when using parallel programming items = [] for item in parallelized_object_factory(): items.append(item) If you want a more specific answer, ask a more specific question. -- John Gordon A is

Re: while Loops

2016-06-22 Thread John Gordon
ing at 5, and only stop when i is 6. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- https://mail.python.org/mailman/listinfo/python-list

Re: Break and Continue: While Loops

2016-06-23 Thread John Gordon
ode prints i and THEN adds one to it. So i is 4, it gets printed, then 1 is added to it, so it becomes 5 and then the loop exits. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: what the heck this code is doing?

2016-07-01 Thread John Gordon
27;?? It loops through the child items in entry, looking for one with a 'key' value of 'Track ID'. If it finds one, it sets found=True and loops one more time, returning the text of the *next* child element. It depends on the 'key' element being directly followed by the &#

Re: JSON result parsing

2016-07-29 Thread John Gordon
return results['ID'] else: return 'something else' -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tin

Re: Microsoft Hatred FAQ

2005-10-27 Thread John Gordon
In <[EMAIL PROTECTED]> "David Schwartz" <[EMAIL PROTECTED]> writes: > What is an "illegal monopoly"? A monopoly that acts in certain ways, abusing its monopoly power. There's nothing inherently illegal about having a monopoly; it only becomes ill

Re: Microsoft Hatred FAQ

2005-10-27 Thread John Gordon
In <[EMAIL PROTECTED]> "David Schwartz" <[EMAIL PROTECTED]> writes: > When you say "it only become illegal", you are just being vague. Nothing > becomes illegal. The abuse is illegal, but it never was legal. You're splitting hairs. B

Re: The input and output is as wanted, but why error?

2013-12-03 Thread John Gordon
/1smv > Please, I need help. You'll have to explain more about your problem. What, exactly, is wrong? If, as you say, the input and output is correct, then why do you say there is a problem? -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.

Re: PIL(Pillow) fails with PNG image

2013-12-05 Thread John Gordon
In tastyminerals writes: > d= Image._getdecoder(self.mode, d, a, self.decoderconfig) > AttributeError: 'module' object has no attribute'_getdecoder'||| Do you have your own module named Image.py? -- John Gordon Imagine what it must be like for a

Re: python import error

2013-12-10 Thread John Gordon
> aaa.py > sss.py A python file isn't importable unless the directory also contains a file named __init__.py . Try making __init__.py files in the ccc and ddd directories. If you don't know what to put in them, just leave them blank. -- John Gordon Imagine what it mu

Re: python import error

2013-12-11 Thread John Gordon
in when you run your python command? As written, your import will only work if you're in the parent directory of ccc (or that directory is in your PYTHONPATH.) -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

Re: Downloading multiple files based on info extracted from CSV

2013-12-12 Thread John Gordon
you have the close-parenthesis in the wrong place. The call should look like this: urllib.urlretrieve(f, "%g.csv" % clientname) "%g" returns a floating-point value. Did you mean "%s" instead?) -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

Re: Need help with file object

2013-12-12 Thread John Gordon
so, it really helps if you post the real code and real error message. Don't type them from memory. -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

Re: Concatenate string list to number list to form title - Logic needed.

2013-12-16 Thread John Gordon
27;] > Note : First 2 values from each list should be ignored. > Could anyone please guide me with best solution without loops ? output_list = [] t = ['Start','End'] a = [[1,2,3,4], [5,6,7,8]] output_list.append('%s - %s, %s - %s' % (t[0], a[0][2], t

Re: Question RE urllib

2013-12-16 Thread John Gordon
tion, e: print site + " is down" print str(e) -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

Re: python copy selected lines from one file to another using argparse or getopt

2014-01-08 Thread John Gordon
ch - a list of words to search for. args.exclude - a list of words to exclude. Can be None. args.input_file - the input file name. args.output_file - the output file name. -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

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

2014-01-10 Thread John Gordon
x27;: para.append(None) else: para.append(item) The python csv module might have a better way to do this; have a look. -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python solve problem with string operation

2014-01-16 Thread John Gordon
3377" > operation-> (3)(44)()(333)(11)(2)(33)(77) > output: "34131237" input = "3443331123377" output = [] previous_ch = None for ch in input: if ch != previous_ch: output.append(ch) previous_ch = ch print ''.join(ou

Re: Python solve problem with string operation

2014-01-16 Thread John Gordon
27;.join(output) > > > Cheat, you've used a list :) Ack! I missed that the OP doesn't want to use lists. Well, let's try this instead: import sys input = "3443331123377" previous_ch = None for ch in input: if ch != previous_ch

Re: Separate Address number and name

2014-01-21 Thread John Gordon
York > I have struggled with this for a while and know there must be a simple > method to achieve this result. for line in input_lines: fields = line.split() farm_id = fields[0] address_num = fields[1] address_name = ' '.join(fields[2:]) -- John Gordon

Re: Eclipse IDE printing values automatically

2014-01-29 Thread John Gordon
code here and maybe we can help. Or, if your program is short enough, you can just post the whole thing here. Be sure to give an example of the unwanted output, and tell us exactly how the program is being executed. If the program uses input files, be sure to give us those too. -- John Gordon

Re: Unable to Launch Python 2.7 after Windows 8.1 Update

2014-02-02 Thread John Gordon
Py= > thon IDLE from opening?=20 Try opening a command window and run Python from there; that way you'll be able to see any error mesages that crop up. -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', o

Re: Finding scores from a list

2015-11-24 Thread John Gordon
back (most recent call last): > File "", line 1, in > print((results["gengyang"])["score"]) > TypeError: list indices must be integers, not str Lists are indexed by number, not by name. You want something like this: for result in results:

Re: if else python

2015-11-26 Thread John Gordon
e in a loop, so perhaps you're seeing the 'if' branch on one loop iteration, anf the 'else' branch on the next iteration? I see that your if and else branches both contain a screen.addstr() call. Are you seeing both of these outputs? -- John Gordon A is fo

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread John Gordon
re is almost always *MANY* ways to > achieve the same output.=20 The koan reads: There should be one-- and preferably only one --obvious way to do it. You left out the rather important word "obvious". -- John Gordon A is for Amy, who fell down the stairs gor...

Re: error reading api with urllib

2015-12-16 Thread John Gordon
your Request object. Try doing that. (It works in your browser because it defaults to GET automatically.) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, &qu

Re: imshow keeps crashhing

2015-12-22 Thread John Gordon
ble SCIPY_PIL_IMAGE_VIEWER. If that variable is not present, it uses 'see' by default. Do you have a suitable image viewing program installed on your computer? If so, try setting the SCIPY_PIL_IMAGE_VIEWER environment variable to the name of that program. -- John Gordon

Re: Why is there difference between cmd line and .py file?

2016-01-05 Thread John Gordon
> IndexError: invalid index to scalar variable. > // The built-in function sum() returns a single value, not a list, so this is a reasonable error. I suspect the code actually intended to call numpy.sum(), which does return a list (or something like a list). -- John Gordon

Re: imshow keeps crashhing

2016-01-06 Thread John Gordon
Do you have any > suggestions? I don't really know much about Macs... Can you run Preview and open the temporary file successfully? When launched from scipy, Does Preview run as a user other than yourself? What are the permissions on the temporary file when it's originally create

Re: imshow keeps crashhing

2016-01-06 Thread John Gordon
it even show up as a choice? Is there something special about the /private directory? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrum

Re: Question about a class member

2016-01-07 Thread John Gordon
transmat_ = transmat > model.means_ = means > model.covars_ = covars > # Generate samples > X, Z = model.sample(50) > - sample() is a method in the GaussianHMM class. (In this case, it's a method in the _BaseHMM class, from which GaussianHMM inherits.) -- John Gord

Re: importing: what does "from" do?

2016-01-21 Thread John Gordon
#x27;utilities' module? Does it, in fact, contain something named 'hexdump'? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb

Re: importing: what does "from" do?

2016-01-21 Thread John Gordon
contain > > something named 'hexdump'? > Yes In that case, the problem is most likely a circular import issue, as you mentioned. The only way to fix it is to reorganize your modules. How did this error come up? Did the code work previously? If so, what changed? -- Jo

Re: importing: what does "from" do?

2016-01-21 Thread John Gordon
You shouldn't have to rewrite any of the actual code. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- https://mail.python.org/mailman/listinfo/python-list

Re: Continuing indentation

2016-03-03 Thread John Gordon
In <871t7sbkex@elektro.pacujo.net> Marko Rauhamaa writes: > Ethan Furman : > > No, it isn't. Using '\' for line continuation is strongly discouraged. > Why would you discourage valid syntax? Some things that are permissible may not be desirable. -- J

Re: list reversal error

2016-03-03 Thread John Gordon
valuates to j = len(data) which would yield 5 for a five-element list, but the last actual element is in data[4]. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears --

Re: password and username code

2016-03-06 Thread John Gordon
inding out if a name is registered? There are lots of possible ways to do it. Do you have one in mind? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "Th

Re: from a module return a class

2016-03-18 Thread John Gordon
; > callable. promptUser_PWord() has to be a function or a class. > > > Yes, but I guess the OP's program will run into the SyntaxError when > trying to import the module, i.e., before it ever encounters the > TypeError: 'module' object is not callable. Good poi

Re: from a module return a class

2016-03-18 Thread John Gordon
en't callable. promptUser_PWord() has to be a function or a class. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- htt

Re: from a module return a class

2016-03-19 Thread John Gordon
taxError: 'return' outside function Show us the complete definition of promptUser_PWord(). -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "Th

Re: from a module return a class

2016-03-19 Thread John Gordon
It has to be a function or a class. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- https://mail.python.org/mailman/listinfo/python-list

Re: Not downloading

2016-03-23 Thread John Gordon
P, try using an older 3.4 version of Python. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- https://mail.python.org/mailman/listinfo/python-list

Re: Code review

2014-11-04 Thread John Gordon
or two. Some blank lines wouldn't hurt either. Also it would be nice to define some of the terms you're using. What is a blind? What does "in front" mean? What is a "muck hand"? -- John Gordon Imagine what it must be like for a real medical doctor to gor

Trouble getting full response content from PATCH request

2014-11-17 Thread John Gordon
body = raw_xml.format(password='hello') headers = {'Content-type': 'text/xml'} url = 'https://some.server.com/api/call/' response = requests.patch(url, data=body, auth=auth, verify=False, headers=headers) print 'HTTP status

Re: How do you download and install HTML5TreeBuilder ?

2014-11-18 Thread John Gordon
;pip install HTML5', three times, with exactly the same result each time. Did you mean to execute the same command three times over? If so, did you expect to get different results the second or third time? -- John Gordon Imagine what it must be like for a real medical doctor to gor...

Re: Trouble getting full response content from PATCH request

2014-11-19 Thread John Gordon
uot; HTTP header with SOAP requests. It may be that > simple. The API does provide some SOAP calls, but the specific call I'm using is REST. Is there a corresponding header I should use? Thanks. -- John Gordon Imagine what it must be like for a real medical doctor to gor.

Re: Dictionary error

2014-11-25 Thread John Gordon
ng zip on two single items, not sequences, and you can't do that. Glancing over the code it appears that you're saving the cell contents in two lists, x and y. Perhaps you meant to call zip on those lists instead of on keys and values? -- John Gordon Imagine what it must be li

Re: Cherrypy - prevent browser "prefetch"?

2014-12-02 Thread John Gordon
ta modifications, but I thought it was allowed for things like logging out of your session. -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

Re: Parsing XML Using XPATH for Python

2014-12-02 Thread John Gordon
oringCellRelation'): # print the id's of the serving and neighbor cells print("%s--%s" % (serving_cell.attrib['id'], neighbor.attrib['id'])) -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to schedule my script?

2014-12-17 Thread John Gordon
given time and stop at another given time, > is that possible? You could write a separate program whose only job is to send a STOP or CONTINUE signal to your main program, and then run that program from a scheduler. The standard system "kill" command would probably work for this purp

Re: Is there a way to schedule my script?

2014-12-17 Thread John Gordon
thing common like that? If you're on Unix, 'kill' and 'cron' are already built-in. If you want to solve your problem entirely within Python, look at the "scheduler" module. (Although even this isn't a complete solution, as you still have to make sure the progr

Re: problems with Methods in Python 3.4.2

2014-12-18 Thread John Gordon
> >>> -3 .abs() > AttributeError: 'int' object has no attribute 'abs' Integer objects don't have a built-in function named abs(). If you want the absolute value of an integer, call abs directly, like so: abs(-3) -- John Gordon Imagine what it must

Re: Program calling unwanted functions

2014-12-22 Thread John Gordon
see, every possible logic branch ends up with a call to cameraman(). The kid function doesn't call instructions, but the last line of your script does call it, unconditionally. -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch &#x

Re: cx_Oracle, callfunc and varray

2015-01-09 Thread John Gordon
what I'm doing wrong? Is RETURN INTEGER; allowed? -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

Re: Concatenate list values

2015-02-23 Thread John Gordon
Any help appreciated big_string = ', '.join(my_list[1:]) -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

Re: Top down Python

2014-02-11 Thread John Gordon
Sure, it's a little more work for the user, but it will pound any type of nail though a variety of surfaces. I.e., it's reusable. -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to w

Re: How to use logging

2014-02-17 Thread John Gordon
aspect of logging, like sending the output to a file instead of the default destination? -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

Re: Why is the interpreter is returning a 'reference'?

2014-02-17 Thread John Gordon
thod upper of str object at 0x02283F58>] > Why doesn't the python interpreter just return > ['HI, 'BOSS'] ? > This isn't a big deal, but I am just curious as to why it does this. Because you typed 'str.upper' instead of 'str.upper()'. -

Re: Error getting REMOTE_USER Environment Variable

2014-02-20 Thread John Gordon
rstanding. Is this a bug in the os package that comes > with Python 3.3? Anybody got a fix for it? If there is a bug, it's much more likely to be in the webserver code that sets the REMOTE_USER value. -- John Gordon Imagine what it must be like for a real medical doctor to

Re: The sum of numbers in a line from a file

2014-02-20 Thread John Gordon
sum1 = int(fields[4]) + int(fields[5]) + int(fields[6]) sum2 = int(fields[7]) + int(fields[8]) # compute the averages average1 = sum1 / 3.0 average2 = sum2 / 2.0 # display output print '%s %f %f' % (name, average1, average2) -- John Gordo

Re: Just For Inquiry

2014-02-20 Thread John Gordon
ipated. Communicate with customers to keep them informed of the project's progress. Schedule meetings with the customer as needed. Ensure that a test plan exists and is carried out. Coordinate project delivery and installation. Coordinate bug reports and bugfixes. -- John Gordon Imagine w

Re: intersection, union, difference, symmetric difference for dictionaries

2014-03-01 Thread John Gordon
In mauro writes: > - Dictionaries and sets are both accessed by key As far as I have used sets, they are not accessed by key. >>> x = set([1, 2, 'buckle my shoe']) >>> x set([1, 2, 'buckle my shoe']) >>> 1 in x True >>> 5 in x False

Re: How do I process this?

2014-03-03 Thread John Gordon
nt, like this: t1 = test1.split(',')[0] t2 = test2.split(',')[0] -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

Re: beautiful soup get class info

2014-03-06 Thread John Gordon
In teddyb...@gmail.com writes: > October 22, 2011 > date1 = soup.span.text > data=soup.find_all(date="value") Try this: soup.find_all(name="span", class="date") -- John Gordon Imagine what it must be like for a real medical doctor to gor..

Re: beautiful soup get class info

2014-03-06 Thread John Gordon
it twice Are there two occurrences of 'March 5, 2014' in the HTML? If so, then beautifulsoup is doing its job correctly. It might help if you posted the sample HTML data you're working with. -- John Gordon Imagine what it must be like for a real medical doctor to g

Re: Oddity using sorted with key

2014-03-11 Thread John Gordon
s the str.lower() function object, which is a silly thing to sort on. Surely you want to sort on the *result* of that function, which is what your second print does. -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House'

Re: unittest weirdness

2014-03-11 Thread John Gordon
haps that's the issue? -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

Re: DB API question - where is a stored procedure's return value?

2014-03-13 Thread John Gordon
In Petite Abeille writes: > Alternatively=85 if it=92s really a function=85 wrap it in a select = > statement=85 such as: > select foo() as value from dual That will get the return value into an SQL variable, but the OP wanted to know how to fetch it from python code. -- Jo

Re: Ordering in the printout of a dictionary

2014-03-17 Thread John Gordon
repr()), > explicitly iterate over it, like this: > def display(d): > return '{'+','.join('%r: %r'%(key,d[key]) for key in sorted(d))+'}' You could also use the OrderedDict type, which is subclass of dict that preserves insertion order. -- John

Re: Dictionaries

2014-03-20 Thread John Gordon
rd requires an iterable as the second part, and has_key() returns only True or False. Therefore, I would say that line of code never executes, which means that the preceding 'if Batch1.has_key(k)' statement always evaluates to False. Which therefore means that Batch2 and Batch3 never accum

Re: running python 2 vs 3

2014-03-20 Thread John Gordon
#x27;shebang' entry as the first line in the file which specifies the program that shall be executed; -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

Re: File Path/Global name issue

2014-03-20 Thread John Gordon
ocation to an influence matrix file by using the '-mf' or '--infmat_file' arguments. There are also -d and -l options that do ... something. -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

Re: Retrieve item deep in dict tree?

2014-04-02 Thread John Gordon
; I'm using Python 2.7. How about three lines? subtree = tree for key in keys: subtree = subtree.get(key) -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python, Linux, and the setuid bit

2014-04-14 Thread John Gordon
f (envp_write < envp_read) > { > memset(envp_write, 0, ((unsigned int) envp_read - > (unsigned int) envp_write)); > } I think it's complaining about casting the char ** objects to unsigned int. -- John Gordon Imagine what it

Re: random.seed question (not reproducing same sequence)

2014-04-15 Thread John Gordon
In Nick Mellor writes: > No "random" module method is used anywhere else while this code is > executing. Are you sure? How did you verify this? -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House',

Re: random.seed question (not reproducing same sequence)

2014-04-15 Thread John Gordon
ucts is %s" % [(rnd.choice(PRODUCTS), rnd.choice(range(10))) for r in range(rnd.randrange(7))]) Run that code sample and see if the results differ when qty is 4 vs 0. -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a

Re: New to Python. For in loops curiosity

2014-05-13 Thread John Gordon
lay.txt as one long string because 'for line in fin:' tells it to read line-by-line. If you want to read the entire contents, use the read() method: file_content = fin.read() -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.com

Re: Putting Py 3.4.1 to work.

2014-05-20 Thread John Gordon
\\lib\\site-packages', > 'C:\\Python34\\Lib\\site-packages\\PySide'] > >>> --- > import PySide > Traceback (most recent call last): > File "", line 1, in > ImportError: No module named 'PySide' Is there a file named __init__.py in the PyS

Re: Advice for choosing correct architecture/tech for a hobby project

2014-05-22 Thread John Gordon
hat do you mean by saying "webbrowser's won't allow client to open hyperlinks with file protocol"? Of course they do. My web browser works just fine with links such as this: foo.html -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwa

Re: Advice for choosing correct architecture/tech for a hobby project

2014-05-22 Thread John Gordon
. Aha! I didn't know that. Now that I think about it, I suppose it makes sense. Perhaps the OP could write a separate application for handling local files, something like: -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch &#x

Re: need help with this code please fix it or at least tell me what im doing wrong

2014-05-28 Thread John Gordon
In <8bc01036-ee9e-4de9-b569-7039dcc05...@googlegroups.com> funky writes: What do you want the program to do? What is it doing instead? Do you get any error messages? Don't just throw code at us and ask us to fix it... -- John Gordon Imagine what it must be like for a r

Re: passing Python assignment value to shell

2014-05-28 Thread John Gordon
e of freecalc_total here>'], stdout=devnull,stderr=subprocess.STDOUT) > devnull.close() I think you can just include freecalc_total directly as part of the argument list, like this: runCommand = subprocess.call(['stressapptest', freecalc_total], stdout=devnull, std

Re: Embedding numpy works once, but not twice??

2014-06-04 Thread John Gordon
; answers. His post title began with "Re: ", so I assume it was a followup to an (possibly expired) original post that did have context. -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer t

Re: ImportError: No module named appengine.ext

2013-07-31 Thread John Gordon
Has the Google App Engine library been installed on your system? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: Am I not seeing the Error?

2013-08-12 Thread John Gordon
Process(write2file('./mem/ENGINE_PID', ENGINEPID); You have too many ('s this line. > write2file(SENTEMPPATH, ''); write2file(INPUTMEM, '')); And too many )'s on this one. -- John Gordon A is for Amy, who fell down the sta

Re: Getting a value that follows string.find()

2013-08-14 Thread John Gordon
In <40816fed-38d4-4baa-92cc-c80cd8feb...@googlegroups.com> englishkevin...@gmail.com writes: > I know the title doesn't make much sense, but I didnt know how to explain my > problem. > Anywho, I've opened a page's source in URLLIB > starturlsource = starturlopen.read() > string.find(starturlsou

Re: Replace blanks with letter

2013-08-21 Thread John Gordon
sly, but we don't know what it's *supposed* to do. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://ma

Re: What does sys.stdout.flush() do?

2013-08-23 Thread John Gordon
n't necessarily get written right away. In particular, screen output often waits until it receives a newline before displaying anything. flush() makes sure it all gets written *right now*. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is

Re: Monitor key presses in Python?

2013-09-09 Thread John Gordon
a function that waits for the user to press a key and then returns the key that was pressed? Or are you asking for a function that detects whether a key has been pressed at all? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Bas

<    1   2   3   4   5   >