Re:find and replace string in binary file

2014-03-05 Thread Dave Angel
loial Wrote in message: > How do I read a binary file, find/identify a character string and replace it > with another character string and write out to another file? > > Its the finding of the string in a binary file that I am not clear on. > > Any help appreciated > I see from another messa

Re: Working with the set of real numbers

2014-03-05 Thread Dave Angel
Oscar Benjamin Wrote in message: > On 4 March 2014 23:20, Dave Angel wrote: >> >> One problem with complexity claims is that it's easy to miss some >> contributing time eaters. I haven't done any measuring on modern >> machines nor in python, but I&#x

Re: Working with the set of real numbers

2014-03-05 Thread Dave Angel
Dave Angel Wrote in message: > Oscar Benjamin Wrote in message: >> On 4 March 2014 23:20, Dave Angel wrote: >>> >>> If anyone is curious, I'll be glad to describe the algorithm; >>> I've never seen it published, before or since. I got my >

Re:Testing interactive code using raw_input

2014-03-10 Thread Dave Angel
Steven D'Aprano Wrote in message: > Does anyone have any good hints for testing interactive code that uses > raw_input, or input in Python 3? > > A simple technique would be to factor out the interactive part, e.g. like > this: > > # Before > def spam(): > answer = raw_input(prompt) >

Re:Save to a file, but avoid overwriting an existing file

2014-03-12 Thread Dave Angel
zoom Wrote in message: > Hi! > > I would like to assure that when writing to a file I do not overwrite an > existing file, but I'm unsure which is the best way to approach to this > problem. As I can see, there are at least two possibilities: > > 1. I could use fd = os.open("x", os.O_WRONLY |

Re: Question about Source Control

2014-03-18 Thread Dave Angel
Steven D'Aprano Wrote in message: > On Tue, 18 Mar 2014 19:08:17 +1100, Chris Angelico wrote: > >> On Tue, Mar 18, 2014 at 6:55 PM, Steven D'Aprano >> wrote: >>> I don't think that *version* control is the right model to describe >>> what hg and git do, although it may be appropriate for subve

Re: Decorator

2014-03-20 Thread Dave Angel
Peter Otten <__pete...@web.de> Wrote in message: > > In your code change > > fib1 = isOddMy(fib) > > to > > fib = isOddMy(fib) > > and the without@ version will produce the same output as the with@ version. > > I expect that one more thing is needed, since the above is inside a functio

Re:Dictionaries

2014-03-20 Thread Dave Angel
Please don't leave new questions in an existing thread, and especially without changing subject line. Compose a new message with meaningful subject line. ishish Wrote in message: > Hi, > > This might sound weird, but is there a limit how many dictionaries a > can create/use in a single scr

Re:Python - Caeser Cipher Not Giving Right Output

2014-03-20 Thread Dave Angel
dtran...@gmail.com Wrote in message: > Hello good people I am working on a caeser cipher program for class. However, > I ran into a problem with my outputs. Up to a certain point for example: > > 1. two('y', 'z') > > Would give a '\x92' output instead of a 'x' output. > > Currently this is my

Re: Python - Caeser Cipher Not Giving Right Output

2014-03-20 Thread Dave Angel
dtran...@gmail.com Wrote in message: > On Thursday, March 20, 2014 11:16:50 PM UTC-4, Dave Angel wrote: >> dtran...@gmail.com Wrote in message: >> > >> >> > def two(c1 , c2): >> >> > c1 = chartonum(c1) >> >> >

Re:terminate a program gracefully from a thread

2014-03-22 Thread Dave Angel
Jabba Laci Wrote in message: > Hi, > > I have a script (see below) that I want to terminate after X seconds. > The main loop of the program is waiting for user input. > The program enters the main loop and I try to shut down the program > after X seconds from a thread but I can't figure out how

Re:User prompt as file to read

2014-03-22 Thread Dave Angel
kjaku...@gmail.com Wrote in message: > I'm trying to create a program that will prompt the user for a list of text > files to read from, then read those text files and build a dictionary of all > the unique words found. Then finally put those unique words into another file > and make it alphabe

Re: Question about Source Control

2014-03-22 Thread Dave Angel
Albert-Jan Roskam Wrote in message: > In addition to posting in html format, you have also set the font size too small for me to easily read. Reason number 12 for posting in text mode in a text newsgroup. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Re:gdb python how to output integer for examine memory

2014-03-24 Thread Dave Angel
Wesley Wrote in message: > Hi all, > I am trying to use gdb debug python script. > I am using gdb7.7 and python2.7.6, here is my simple test script: > import time > > def next(i): > time.sleep(10) > i = 1 - i > > i = 1 > while True: > next(i) > When this script running, gdb attac

Re: [newbie] confusion concerning fetching an element in a 2d-array

2014-03-25 Thread Dave Angel
Jean Dubois Wrote in message: > Op dinsdag 25 maart 2014 12:01:37 UTC+1 schreef Steven D'Aprano: >> >> py> values = [float(s) for s in data.split()] >> py> print values >> [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0] >> py> array_lines = np.array(values) >> py> array_lines = array_lines.reshape

Re:unicode as valid naming symbols

2014-03-25 Thread Dave Angel
Mark H Harris Wrote in message: > greetings, I would like to create a lamda as follows: > > √ = lambda n: sqrt(n) > > > On my keyboard mapping the "problem" character is alt-v which produces > the radical symbol. When trying to set the symbol as a name within the > name-space gives a synta

Re: [newbie] confusion concerning fetching an element in a 2d-array

2014-03-25 Thread Dave Angel
Jean Dubois Wrote in message: > Op dinsdag 25 maart 2014 15:42:13 UTC+1 schreef Dave Angel: >> If your instructor wanted you to copy examples, he would have >> given you one. > please Dave leave that belittling tone behind, there's no instructor > whatsoever inv

Re: Python language hack for C-style programmers [DO NOT USE!] :-)

2014-03-27 Thread Dave Angel
Chris Angelico Wrote in message: > On Fri, Mar 28, 2014 at 3:08 AM, Tim Chase > wrote: >> Multiple times, I've seen someone want something like what C-style >> languages offer where assignment is done in a test, something like >> >> if (m = re.match(some_string)): >> do_something(m) > > I

Re:SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC

2014-03-27 Thread Dave Angel
tade.an...@gmail.com Wrote in message: > > hei , > > I am a newcome to Python. > > I am trying to create a python script which will connect to an SSL URL and > using the HEAD request will get the status of URL. > > For one the link I am getting following error > > [SSL: DECRYPTION_FAILED_

Re: Keyboard standards

2014-03-29 Thread Dave Angel
Larry Hudson Wrote in message: > On 03/28/2014 09:26 PM, Mark H Harris wrote: >> >> PS Thunderbird puts *both* the list and the news group addys in the to: >> header field on >> reply-to-list. ~nice, huh. > > Must be the way YOU set it up. MY Thunderbird (currently version 24.4.0 on > Min

Re: checking if two things do not equal None

2014-03-29 Thread Dave Angel
Roy Smith Wrote in message: > In article , > Johannes Bauer wrote: > >> On 29.03.2014 20:05, Steven D'Aprano wrote: >> > On Sat, 29 Mar 2014 11:56:50 -0700, contact.trigon wrote: >> > >> >> if (a, b) != (None, None): >> >> or >> >> if a != None != b: >> >> >> >> Preference? Pros? Cons? Altern

Re: Test post via gmane.

2014-04-03 Thread Dave Angel
Terry Reedy Wrote in message: > On 4/3/2014 9:48 AM, Chris Angelico wrote: >> On Thu, Apr 3, 2014 at 10:39 AM, Terry Reedy wrote: >>> Gmane has stopped receiving mail from the lists it mirrors at about 0:30 apr >>> 2 (utc, I presume). I want to see what happens if I send to the list via >>> gmane

converting strings to hex

2014-04-03 Thread dave em
last): File "/media/.../Crypto/Attackv2.py", line 10, in k=m1^c1 TypeError: unsupported operand type(s) for ^: 'str' and 'long' Any help is most appreciated. Dave -- https://mail.python.org/mailman/listinfo/python-list

Re: converting strings to hex

2014-04-03 Thread dave em
On Thursday, April 3, 2014 8:31:42 PM UTC-6, Tim Chase wrote: > On 2014-04-03 19:10, dave em wrote: > > > So my first step is to compute the key. I suspect my error below > > > is because c1 is a float and m1 is a string but I don't know how to > >

Re: converting strings to hex

2014-04-03 Thread dave em
> You haven't seen nothing yet, wait till M.L. catches you on the flip > > side for using gg. {running for cover} Who is ML? -- https://mail.python.org/mailman/listinfo/python-list

Re: Default mutable parameters in functions

2014-04-04 Thread Dave Angel
Dennis Lee Bieber Wrote in message: > On Fri, 04 Apr 2014 10:00:25 -0400, random...@fastmail.us declaimed the > following: > >> >>I can't imagine a language that would work that way. For one, it would >>also imply that passing a value would change the default for future >>calls even for non-mutab

Re:If statement issue driving me nuts

2014-04-05 Thread Dave Angel
Anthony Smith Wrote in message: > Hi > > I have a small project and I have been unable to get the following statement > to work. Any help would great. > User inputs can either self_sale_head which is a $ value,if a $ value is not > add a self.estimated_weight_hd is used to get the total weight,

Re:Unpacking U-Boot image file

2014-04-09 Thread Dave Angel
"trewio" Wrote in message: > How to extract files from U-Boot image file, LZMA-compressed? > > Is there a Python script that can do this properly? > Use the lzma module in Python 3.3 for starters -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Re: Unpacking U-Boot image file

2014-04-09 Thread Dave Angel
"trewio" Wrote in message: > U-Boot format: hmm, I'm not sure, can someone specify Python script that will > help me deterermine U-boot format used? [for Python for Windows OS] > > Note: I need Python script for Python under Windows OS. > > >> - Original Message - >> From: Rustom Mody

Re:Learner looking for assistance

2014-04-14 Thread Dave Angel
Anthony Smith Wrote in message: > Hi All > > I am probably doing something wrong but don't know what > Any help would great > As Ben pointed out, you should be more careful with your copy/paste, and especially with your indentation. I'll assume these are all methods of a single class Sal

Re:MemoryError in data conversion

2014-04-14 Thread Dave Angel
Mok-Kong Shen Wrote in message: > > The code attached below produces in one of the two IMHO similar cases > (excepting the sizes of the lists involved) MemoryError. Could experts > kindly tell why that's so and whether there is any work-around feasible. Where's your stack trace for the error? I

Re:Python, Linux, and the setuid bit

2014-04-14 Thread Dave Angel
Ethan Furman Wrote in message: > For anyone in the unenviable position of needing [1] to run Python scripts > with the setuid bit on, there is an > suid-python wrapper [2] that makes this possible. > > When I compiled it I was given a couple warnings. Can any one shed light on > what they mea

Re:TeX $\times$ symbol not working in matplotlib?

2014-04-18 Thread Dave Angel
gwhite Wrote in message: > Hi, > > I am trying to understand how to get the TeX "\times" symbol to work. It is > in the title() string in the code I pasted in. The "\circ" symbol seems > fine, by comparison. "\times" ends up as "imes" in the figure title. > > I am probably doing something d

Re:module and namespace

2014-04-18 Thread Dave Angel
Egon Frerich Wrote in message: > I have a problem with a namespace. > So you started 4 separate threads to complain about it? Keep any further remarks on the thread where you got a useful response. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Re: how to write list in a file

2014-04-23 Thread Dave Angel
Terry Reedy Wrote in message: > On 4/23/2014 3:53 AM, Dhananjay wrote: >> Hello everyone, >> >> I am trying hard to write a list to a file as follows: >> >> >> def average_ELECT(pwd): >> os.chdir(pwd) > > I would 'print pwd' to make sure where files are being opened. > >> files = filte

Re:Moving to an OOP model from an classically imperitive one

2014-04-23 Thread Dave Angel
tim.thel...@gmail.com Wrote in message: > I don't really understand your problem or your examples, but others apparently do. So I'll just make a few comments. > > There is one problem though. Currently, I have these functions logically > organized into source files, each between 40 and 17

Re:Significant digits in a float?

2014-04-28 Thread Dave Angel
Roy Smith Wrote in message: > I'm using Python 2.7 > > I have a bunch of floating point values. For example, here's a few (printed > as reprs): > > 38.0 > 41.2586 > 40.752801 > 49.25 > 33.7951994 > 36.8371996 > 34.1489 > 45.5 > > Fundamentally, these numbers have betwe

Re:Convert numpy array to single number

2014-04-28 Thread Dave Angel
mboyd02...@gmail.com Wrote in message: > I have a numpy array consisting of 1s and zeros for representing binary > numbers: > > e.g. > > >>> binary > array([ 1., 0., 1., 0.]) > > I wish the array to be in the form 1010, so it can be manipulated. > > I do not want to use built in b

Re:problem with regex

2014-04-28 Thread Dave Angel
dimm...@gmail.com Wrote in message: > i want to find a specific urls from a txt file but i have some issus. First > when i take just two lines from the file with copy paste and assign it to a > variable like this and it works only with triple quotes > > test='''_*_n.jpg","timelineCoverPhoto":"{

Re:Python Image Registration and Cropping?

2014-05-04 Thread Dave Angel
mikejohnrya...@gmail.com Wrote in message: > Hello, > > Is there a Python tool or function that can register two images together > (line them up visually), and then crop them to the common overlap area? I'm > assuming this can probably be done with Python Imaging Library but I'm not > very fam

Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-10 Thread Dave Angel
On 05/10/2014 07:23 PM, Chris Angelico wrote: There is a broad convention that spaces in file names get protected with quotes, though (for instance, tab completion will put quotes around them), so it's not complete chaos. "Complete chaos" is a pretty good description, especially since MS dec

Re: Fortran

2014-05-11 Thread Dave Angel
On 05/11/2014 09:11 PM, Steven D'Aprano wrote: On Mon, 12 May 2014 00:51:01 +0100, MRAB wrote: Certainly not. However they may be different where *you* are :-P I'm using an IBM keyboard, model SK-8820. Mine have an little ridge on the keytop of those keys. I've seen keyboards with thos

Re: Fortran (Was: The "does Python have variables?" debate)

2014-05-11 Thread Dave Angel
On 05/11/2014 02:54 PM, Mark H Harris wrote: >julia> sin(BigFloat(π/4)) > 7.0710678118654750275194295621751674626154323953749278952436611913748 > 20215180412e-01 with 256 bits of precision That answer doesn't seem to come anywhere near 256 bits of precision. Using Python 3.2, >>> x=7071

Re: Why isn't my re.sub replacing the contents of my MS Word file?

2014-05-13 Thread Dave Angel
On 05/12/2014 01:35 PM, scottca...@gmail.com wrote: On Friday, May 9, 2014 8:12:57 PM UTC-4, Steven D'Aprano wrote: Good: # Untested fStr = re.sub(b'&#x(201[2-5])|(2E3[AB])|(00[2A]D)', b'-', fStr) Still doesn't work. Guess whatever the code is for endash and mdash are not

Re: Need help to write data onto an XML file after reading data from another xml file

2014-05-13 Thread Dave Angel
On 05/13/2014 10:31 AM, varun...@gmail.com wrote: Hello Users, I am in dire need of your help. I have been working on this code for quite some time and it is making me restless. All I am trying to do is, 1. Read data from an xml file. Source: http://sndlib.zib.de/coredata.download.action?obje

Re: Everything you did not want to know about Unicode in Python 3

2014-05-14 Thread Dave Angel
On 05/13/2014 09:39 AM, Steven D'Aprano wrote: On Tue, 13 May 2014 07:20:34 -0400, Roy Smith wrote: ASCII *is* all I need. You've never needed to copyright something? Copyright © Roy Smith 2014... I know some people use (c) instead, but that actually has no legal standing. (Not that any reaso

Re: Need help to write data onto an XML file after reading data from another xml file

2014-05-14 Thread Dave Angel
On 05/14/2014 02:49 AM, varun...@gmail.com wrote: I try to add an edge with the source id and destination id over a loop but this is the error I am getting. And the range for the for addEdge is something I have no clue about. python export.py --output topology.xml --xml germany50.xml Traceback

Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-15 Thread Dave Angel
On 05/15/2014 07:30 AM, Simon Evans wrote: Dear Programmers, I noticed a couple of typos in my previous message, so have now altered them thus :- Dear Programmers, As anticipated, it has not been to long before I have encountered further difficulty. Your first thread was about getting Beauti

Re: PEP 8 : Maximum line Length :

2014-05-15 Thread Dave Angel
On 05/14/2014 10:12 PM, Roy Smith wrote: In article , Mark Lawrence wrote: I still remember the cry of anguish when the guy in the computer building at (the then) Portsmouth Polytechnic dropped his cardboard box of punch cards that made up his end of course project. That's why you punch se

Re: struct.unpack: why 's' fmt char convert to bytestring

2014-05-15 Thread Dave Angel
On 05/15/2014 08:34 AM, GuoChao wrote: The Python documentation gives this same example:>>> record = b'raymond \x32\x12\x08\x01\x08' name, serialnum, school, gradelevel = unpack('<10sHHb', record) but get different results as to 's', don't know why this change in Python 3? need extra work

Re: The possibility integration in Python without an equation, just an array-like file

2014-05-16 Thread Dave Angel
On 05/16/2014 04:49 AM, Enlong Liu wrote: Dear All, I have a question about the integration with Python. The equation is as below: and I want to get values of I with respect of V. E_F is known. But for T(E), I don't have explicit equation, but a .dat file containing two columns, the first is E,

Re:All-numeric script names and import

2014-05-21 Thread Dave Angel
Chris Angelico Wrote in message: > If I have a file called 1.py, is there a way to import it? Obviously I > can't import it as itself, but in theory, it should be possible to > import something from it. I can manage it with __import__ (this is > Python 2.7 I'm working on, at least for the moment),

Re:Windows rebooting due to faulty code

2014-05-23 Thread Dave Angel
Ronak Dhakan Wrote in message: > I am learning python, and sometimes when I run a file with a faulty code, > windows gives a message that the system is rebooting and gives me 1 minute to > save my work. Does anyone know how can I fix this? Most of the time a faulty > code gives errors in python

Re: Loop thru the dictionary with tuples

2014-05-25 Thread Dave Angel
Ned Batchelder Wrote in message: > On 5/25/14 8:55 AM, Igor Korot wrote: >> Hi, ALL, >> I have a following data structure: >> >> my_dict[(var1,var2,var3)] = None >> my_dict[(var4,var5,var6)] = 'abc' >> >> What I'm trying to do is this: >> >> for (key,value) in my_dict: >> #Do some stuff >> >>

Re:Command prompt not shown when running Python script with subprocess on Windows

2014-05-27 Thread Dave Angel
ps16thypresenceisfullnessof...@gmail.com Wrote in message: > I have written a Python script with a wxPython GUI that uses subprocess.Popen > to open a list of files that the user provides. One of my users would like to > be able to run a Python script with my application. The Python script he is

Re: Check to see if the script has been previously used?

2014-05-27 Thread Dave Angel
Chris Angelico Wrote in message: > On Tue, May 27, 2014 at 5:45 PM, KC Sparks wrote: >> I was wondering if there was an extension or way that would allow me to >> print instructions if it is the first the the user has used the script. > > The trickiest part is defining the 'user'. Generally, thi

Re: Unicode and Python - how often do you index strings?

2014-06-04 Thread Dave Angel
Chris Angelico Wrote in message: > On Wed, Jun 4, 2014 at 8:10 PM, Peter Otten <__pete...@web.de> wrote: >> The indices used for slicing typically don't come out of nowhere. A simple >> example would be >> >> def strip_prefix(text, prefix): >> if text.startswith(prefix): >> text = text

Re: Python and PyQt (Windows) - AttributeError: 'module' object has not attribute run

2013-08-01 Thread Dave Angel
alesssia wrote: > I developed a python3-PyQt4 application (I’m a newbie!) on a 32-bit Linux > platform, and I’m experiencing some problems when testing it on Windows > platforms (Windows 7 and 8, both 64-bit). > > I have a module called Pmc.py that contains two methods: run and main, but > only

Re: script to Login a website

2013-08-01 Thread Dave Angel
wachk...@gmail.com wrote: > On Wednesday, July 31, 2013 12:21:59 PM UTC-4, John Gordon wrote: >> >> How is the data in 'users.txt' and 'password.txt' organized? Given the >> >> filenames, I would expect that 'users.txt' contains one username on each >> >> line, and 'password.txt' contai

Re: script to Login a website

2013-08-01 Thread Dave Angel
wachk...@gmail.com wrote: > On Wednesday, July 31, 2013 11:33:25 AM UTC-4, wach...@gmail.com wrote: >> I have created a script to log in a website. It gets its username and >> password from two files, then log's in with this credentials. My code is not >> showing me what username it is using to

Re: How do I deal with packet data

2013-08-01 Thread Dave Angel
Pacopag wrote: > Hi. > > I have the hex stream of a packet that a program sent over the network. Now > I want to view the data in the packet. I'm pretty sure the data was just a > string (or at least contains a string), but when I decode it I just get > gibberish. > > For example, the packet

Re: Does Python 'enable' poke and hope programming?

2013-08-01 Thread Dave Angel
CM wrote: > what now strikes me as a Very Bad Habit, which is "poke and hope" > (trial and error) programming (of several names this page provided, I kind > of like that one): > I recall when a "compile" took up to two days, before we got the punched paper tape to begin testing. If we wante

Re: PEP8 revised: max line lengths

2013-08-01 Thread Dave Angel
Terry Reedy wrote: >>> >>> The diff with all the changes is here >>> http://hg.python.org/peps/rev/fb24c80e9afb >> Just out of curiosity, where is "coding cookie" defined? I found enough distant references to decide it was supposed to mean the coding line (line 2, typically in Unix). But I ori

Re: Python and PyQt (Windows) - AttributeError: 'module' object has not attribute run

2013-08-01 Thread Dave Angel
alesssia wrote: >> My guess is that somehow when the zip file was extracted, the case of >> this file was not preserved, and it came out pmc.py. > > The zip was not extracted because there was no zip. I copied the code from my > computer to a USB pen drive and ran the code from there. Tha

Re: PEP8 revised: max line lengths

2013-08-01 Thread Dave Angel
Terry Reedy wrote: > On 8/1/2013 7:33 PM, Dave Angel wrote: >> Terry Reedy wrote: >> >> >>>>> >>>>> The diff with all the changes is here >>>>> http://hg.python.org/peps/rev/fb24c80e9afb >>>> >> >> Just ou

Re: outputting time in microseconds or milliseconds

2013-08-02 Thread Dave Angel
matt.doolittl...@gmail.com wrote: > Hey everybody, > > I am using 2.7 on Ubuntu 12.10. and what version of Python are you using? I don't know if it matters, but it's useful to always supply both Python version and OS version. > All I need to do is to print time with the microseconds. I have b

Re: Python: Code is ignoring the if and else

2013-08-02 Thread Dave Angel
kevin4f...@gmail.com wrote: > I'm trying to create a game of Go Fish in Python. But I've stumbled onto a > little problem that I can't seem to figure out how to deal with. > Please list the program the way you are actually running it. The present one will not run very long before producing

Re: Crawl Quora

2013-08-03 Thread Dave Angel
Umesh Sharma wrote: > Hello, > > I am writing a crawler in python, which crawl quora. I can't read the content > of quora without login. But google/bing crawls quora. One thing i can do is > use browser automation and login in my account and the go links by link and > crawl content, but this me

Re: Removing matching items from a list?

2013-08-03 Thread Dave Angel
kevin4f...@gmail.com wrote: > > Would you also happen to know how I could set up a list that keeps track of > the removed sets? > Let's see, i think that makes 5 times you've asked the same question, counting the dups you apparently sent to the same person. Instead of writing all these mes

Re: outputting time in microseconds or milliseconds

2013-08-04 Thread Dave Angel
matt.doolittl...@gmail.com wrote: > ok so now i import the module like this: > >from time import strftime, time > > i made the write statement like this: > >self.logfile.write('%s\t'%(str(strftime("%Y-%m-%d", >self.logfile.write('%s\t'%(str(strftime("%H:%M:%S", >self.logf

Re: Hangman question

2013-08-04 Thread Dave Angel
eschneide...@comcast.net wrote: > I'm on chapter 9 of this guide to python: > http://inventwithpython.com/chapter9.html but I don't quite understand > why line 79 is what it is (blanks = blanks[:i] + secretWord[i] + > blanks[i+1:]). I particularly don't get the [i+1:] part. Any additional

Re: Creating a running tally/ definitely new to this

2013-08-05 Thread Dave Angel
gratedme...@gmail.com wrote: > > I currently working on a game, where I need to maintain a running tally of > money, as the player makes purchases as they navigate thru game. I not > exactly sure how to do this in python. I know it is a fairly basic step, > nonetheless. Any assistance would

Re: Beginner question

2013-08-06 Thread Dave Angel
eschneide...@comcast.net wrote: > Why won't the 'goodbye' part of this code work right? it prints 'ok' no > matter what is typed. Much thanks. > > def thing(): > print('go again?') > goagain=input() > if goagain=='y' or 'yes': This expression doesn't do what you think. The compariso

Re: beginner question (True False help)

2013-08-07 Thread Dave Angel
eschneide...@comcast.net wrote: > What I wanted to happen is when the user typed something other than 'y' or > 'yes' after being asked 'go again?', the batman==False line would cause the > program to stop asking anything and say 'this is the end'. Instead, what is > happening is that the progra

Re: new to While statements

2013-08-07 Thread Dave Angel
Vito De Tullio wrote: > Dan Sommers wrote: > while "asking for reponse": >>> while "adventuring": >>> >>> that's a funny way to say `while True:`... >> >> Funny, perhaps, the first time you see it, but way more informative than >> the other way to the next one who come

Re: Issues with if and elif statements in 3.3

2013-08-08 Thread Dave Angel
krismesenbr...@gmail.com wrote: > def town(): > print ("You stand in the middle of Coffeington while you descide what" > " to do next, you have herd rumor of the Coffeington Caves that run" > "under the city, would you like to check them out?") > answer = input() > if answer ==

Re: right adjusted strings containing umlauts

2013-08-08 Thread Dave Angel
Kurt Mueller wrote: > Am 08.08.2013 16:43, schrieb jfhar...@gmail.com: >> On Thursday, 8 August 2013 15:23:46 UTC+1, Kurt Mueller wrote: >>> I'd like to print strings right adjusted. >>> print( '>{0:>3}<'.format( 'ä' ) ) >> >> Make both strings unicode >> print( u'>{0:>3}<'.format( u'ä' ) ) >> W

Re: right adjusted strings containing umlauts

2013-08-08 Thread Dave Angel
Kurt Mueller wrote: > Now I have this small example: > -- > #!/usr/bin/env python > # vim: set fileencoding=utf-8 : > > from __future__ import print_function > import sys, shlex > > print( repr( sys.stdin.encoding ) ) > > strg_form = u'{0:>3}

Re: Introduction to my fellow Python Friends

2013-08-11 Thread Dave Angel
Krishnan Shankar wrote: > Hi Friends, Hi, and welcome to the mailing list. > I figured out that the best way is to talk to the experts and so i > subscribed to this mailing list. It will be cool if anybody can help me out > by telling the etiquette of this mailing list, like > > 1. How to

Re: back with more issues

2013-08-11 Thread Dave Angel
Kris Mesenbrink wrote: > import random > > def player(): > hp = 10 > speed = 5 > attack = random.randint(0,5) > The net resut of this function is nothing. It assigns values, then they're lost when the function returns. A function is the wrong way to deal with these three names. > de

Re: back with more issues

2013-08-12 Thread Dave Angel
Kris Mesenbrink wrote: > darn i was hoping i could put off learning classes for a bit, but it seems > that is not the case. i have tested it a bit and it seems to be working > correctly now. > > > import random > > class player(): > hp = 10 > speed = 5 >

Re: Calling Python macro from ctypes

2013-08-12 Thread Dave Angel
Peter Otten wrote: > Steven D'Aprano wrote: > >> Is it possible to call a Python macro from ctypes? For example, Python >> 3.3 introduces some new macros for querying the internal representation >> of strings: >> >> http://www.python.org/dev/peps/pep-0393/#new-api >> >> >> So I try this in 3.3:

Re: multithreading in python

2013-08-13 Thread Dave Angel
samaneh.yahyap...@gmail.com wrote: > hi > my program work by 4 thread but when i use more thread it terminates > > I simplified your code so anybody could run it, and tested it inside Komodo IDE, on Python 2.7 #!/usr/bin/env python import sys import os import time import threading class MyC

Re: multithreading in python

2013-08-13 Thread Dave Angel
samaneh.yahyap...@gmail.com wrote: > hi > my program work by 4 thread but when i use more thread it terminates > > how can i solve this problem I simplified the code so I could actually run it, and tested it in Python 2.7, both under Komodo IDE and in the terminal. The code: #!/usr/bin/en

Re: Question about function failing with large number

2013-08-13 Thread Dave Angel
Anthony Papillion wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > So I'm using the function below to test a large (617 digit) number for > primality. For some reason, when I execute the code, I get an error > telling me: > > OverflowError: long int too large to convert to float In

Re: Am I not seeing the Error?

2013-08-13 Thread Dave Angel
Denis McMahon wrote: > On Sat, 10 Aug 2013 22:19:23 -0400, Devyn Collier Johnson wrote: > >> I am checking my 1292-line script for syntax errors. I ran the following >> commands in a terminal to check for errors, but I do not see the error. > >> JOB_WRITEURGFILES = >> multiprocessing.Process(write

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

2013-08-13 Thread Dave Angel
englishkevin...@gmail.com wrote: > 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(starturlsource, '>> import string >>> help(string.find) Traceback (most

Re: .split() Qeustion

2013-08-13 Thread Dave Angel
eschneide...@comcast.net wrote: > How can I use the '.split()' method (am I right in calling it a method?) > without instead of writing each comma between words in the pie list in the > following code? Also, is there a way to use .split instead of typing the > apostrophes? Thank you. > > import

Re: Verifying Variable value

2013-08-14 Thread Dave Angel
chandan kumar wrote: > Hi , > > Is there a way to validate variable values while debugging any python > code.Run below example  in debugging mode and i would like to know the value > of c (I know print is an option) with any other option other than printing. > In C# or some other tools we can v

Re: .split() Qeustion

2013-08-15 Thread Dave Angel
Terry Reedy wrote: > On 8/15/2013 2:28 PM, Chris Angelico wrote: >> On Thu, Aug 15, 2013 at 5:54 PM, Joshua Landau wrote: >>> On 15 August 2013 16:43, Chris Angelico wrote: A mole is as much a number (6e23) as the light year is a number (9.5e15). >>> >>> A mole is a number. A light year is

Re: .split() Qeustion

2013-08-15 Thread Dave Angel
Roy Smith wrote: > In article <520da6d1$0$3$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano wrote: > >> On Thu, 15 Aug 2013 16:43:41 +0100, Chris Angelico wrote: >> >> > A mole is as much a number (6e23) as the light year is a number >> > (9.5e15). >> >> Not quite. A mole (abbreviat

Re: Local variable in a closure

2013-08-18 Thread Dave Angel
w.w.mil...@googlemail.com wrote: > Is f local or not? > http://pastebin.com/AKDJrbDs Please have a little respect, and include the source in your message. You managed quite nicely to keep it small, but you put it in an obscure place that some people won't be able to reach, and that might not sur

Re: Importing variables non-deterministic?

2013-08-19 Thread Dave Angel
Antoon Pardon wrote: > Op 17-08-13 17:01, Steven D'Aprano schreef: >> >> And here you re-import the name "y" from struct_global. That rebinds the >> current module's "y" with whatever value struct_global.y has *now*, >> rather than a second (or a minute, or an hour) earlier when the first >> i

Re: refresing the edited python function

2013-08-19 Thread Dave Angel
Sudheer Joseph wrote: > Thank you Dieter, > I never thought it will be so difficult task, All I was > thinking was that, I just do not know how it is done. I wonder how the code > developers work in this case every time a function is modified one has to > restart the consol

Re: Importing variables non-deterministic?

2013-08-19 Thread Dave Angel
Antoon Pardon wrote: > Op 19-08-13 11:18, Chris Angelico schreef: >> The issue >> was regarding imports, and it's perfectly safe to import a constant, >> even if the interpreter doesn't protect you from then being a total >> idiot and changing it. > > Python doesn't have constants, so you sta

Re: opposite of __init__.py

2013-08-19 Thread Dave Angel
Tamer Higazi wrote: > Hi people! > > I have asked myself a question, if there is a opposite of "__init__.py" > like "__del__.py" ?! Others have answered your question, but I wanted to correct a misunderstanding: > > I want, that when the application ends, certain functions are executed. > I know

Re: Replace blanks with letter

2013-08-20 Thread Dave Angel
eschneide...@comcast.net wrote: > Is there also a way to have the code remember what I typed and not stop after > the first letter the user types? For example, if I typed 'a' once, thus > returning 'a__', and then typed in 'b', I want the code to return > 'ab_' and so on. I wasn't clear

Re: Replace blanks with letter

2013-08-21 Thread Dave Angel
eschneide...@comcast.net wrote: > Thanks. I am running into a bunch of problems with the following code, all of > which are clear when running the program > > import random > letters='abcdefg' > blanks='_'*len(letters) > print('type letters from a to g') > print(blanks) > for i in range(len(let

Re: Replace blanks with letter

2013-08-22 Thread Dave Angel
eschneide...@comcast.net wrote: > I wanted the program to stop only after all the letters were typed; why in > the world would I try to write a program with blanks for each letter that > seem intended to be filled, only to have it stop if the last letter is typed, > or have to type each letter

Re: Using PyQT with QT Designer

2013-08-23 Thread Dave Angel
Michael Staggs wrote: > > That's the problem though. It is exactly how I want it in designer. It's > perfect as it is in designer when I preview it. Here is a screenshot of the > preview: http://i.imgur.com/ULRolq8.png > > The problem isn't that I can't design it in QT Designer. It is designed >

<    11   12   13   14   15   16   17   18   19   20   >