Re: [Tutor] Copy files

2006-01-31 Thread David Holland
are different"     change_files("test1.txt", "text3.txt")     did_it_work("test1.txt", "text3.txt") else:     x = compare_files("test2.txt","test3.txt" )     i! f x == False:     print "test2 and test3 are different&

Re: [Tutor] Copy files

2006-02-06 Thread David Holland
Alan,Thanks for that.  I had the wrong file names, now it works, in case anyone is interested here is the code.  I use it because at work I need to change different versions of sqlnet.ora :-def compare_files(file_name1, file_name2):     x = filecmp.cmp (file_name1, file_name2)     print

[Tutor] Change files

2006-02-10 Thread David Holland
I wrote a little program that replaces all files called 'abcde' with the file in the directory from which you riun the program.  However it does not find them (there is another one). What have I done wrong :- #this program copies the file x to all other places in the directory. #however it does not

Re: [Tutor] Change files

2006-02-11 Thread David Holland
t shutil #main top = '/home' a = os.getcwd() filename = 'abcde' file1 = filename file2 = a+'/'+filename print file2 getfiles(filename, file2,top) print "finished" David Bruce <[EMAIL PROTECTED]> wrote: I guess that you need to fix two things:1 the indentai

Re: [Tutor] Change files

2006-02-12 Thread David Holland
Thanks,  now I understand and that works perfectly.[EMAIL PROTECTED] wrote: David,  in getfiles, the os.getcwd() points the main programs cwd only and so shutil.copy() fails. so changing to name = os.path.join(root,name) helps us get the file in the directory we checked against.   def

Re: [Tutor] problems with the shebang line and linux

2006-02-16 Thread David Rock
0: 2321 202f 7573 722f 6269 6e2f 7079 7468 #! /usr/bin/pyth 010: 6f6e 0a70 7269 6e74 2022 4865 6c6c 6f22 on.print "Hello" 020: 0a . Bottom line, the error means bash can not find the application you told it to use, so somethin

[Tutor] Problem with threads

2006-02-24 Thread David Cohen
. Does anybody could help me? Regards, David ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Problem with threads

2006-02-26 Thread David Cohen
ick on the "Disconnect" button and the join() function is called. Did you get any problem like that? BR, David On 2/25/06, Kent Johnson <[EMAIL PROTECTED]> wrote: > David Cohen wrote: > > Hi all, > > > > I have a problem trying to use thread on python. >

Re: [Tutor] Telnet to cisco device

2006-02-28 Thread David Heiser
Title: Message   The following works with the Cisco switch that I have available. Cisco 4006 with CatOS 6.2. It may not work with your model/OS or your switch may be configured differently. For instance, the default prompt terminates with "(enable)" so I used "tn.read_until(')')" instead of

Re: [Tutor] Print list vs telnetlib.telnet.write differences

2006-03-02 Thread David Heiser
I believe you can submit the new config content as a blob where blob = string.join(lines). It looks like your "switch" uses IOS, not CatOS, so make sure you send "config t" first. And I would strip out the \r's. Then maybe: tn.write("\03") # Assures the device

Re: [Tutor] Analysing genetic code (DNA) using python

2006-03-06 Thread David Heiser
Here's one approach to the problem (using bogus codon values). -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of sjw28 Sent: Monday, March 06, 2006 8:37 AM To: tutor@python.org Subject: [Tutor] Analysing genetic code (DNA) using python I have many note

Re: [Tutor] scaling values

2006-03-14 Thread David Heiser
Is this what you're asking for? # Scaler.py # def scale(OldList, NewMin, NewMax): NewRange = float(NewMax - NewMin) OldMin = min(x) OldMax = max(x) OldRange = float(OldMax - OldMin) ScaleFactor = NewRange / OldRange print '\nEquasion: NewValue = ((OldValue - ' + str(Old

[Tutor] Fill in a web form

2006-03-18 Thread David Holland
Is there a way in python to automatically put values in a web page ?  For example I used to travel on a train (I live in the UK) that is always late.  Is there a way to automatically to do this ? I can't think of  how to do it. --

Re: [Tutor] Tutor Digest, Vol 25, Issue 47

2006-03-19 Thread David Holland
Message: 8Date: Sat, 18 Mar 2006 14:26:15 -0500From: Kent Johnson Subject: Re: [Tutor] Fill in a web formCc: tutor python Message-ID: <[EMAIL PROTECTED]>Content-Type: text/plain; charset=ISO-8859-1; format=flowedDavid Holland wrote:> Is there a way in python to automatically put values in a web pag

Re: [Tutor] Searching across .Py files for a particular string/character

2006-03-30 Thread David Heiser
Here's a simple Python script that will do it. It's not very sophisticated, but it's easy to modify for special cases. import os, string def Find(TargetString, DIR, Names): for Name in Names: if Name != "Search.py": try: TargetFile = DIR + "/" + Name

Re: [Tutor] file?

2006-04-03 Thread David Rock
s: import zipfile try: ziparchive = zipfile.ZipFile(inputfilename, "r") except: print "error accessing file" You could get fancy and deal with various exceptions or read traceback info, too. Using the try block is generally considered

Re: [Tutor] for loops

2006-04-11 Thread David Rock
generally try to stay away from doing the work for you :-) -- David Rock [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Show us some code

2006-04-13 Thread David Holland
John,Can you please post your code and the exact error message. First they came for the Danes, but I did not speak out because I am not a Dane. Yahoo! Messenge

Re: [Tutor] School Boy Error

2006-04-15 Thread David Rock
se. I am trying to upload the first line in the > file to get myself started. The code is below:- You may want to check out the csv module to aid in any odd data input, too. http://docs.python.org/lib/module-csv.html -- David Rock [EMAIL PROTECTED] ___

[Tutor] Python challenge

2006-05-04 Thread David Holland
I looked at this and got stuck on the first one :- http://www.pythonchallenge.com/pc/def/0.html It says try changing the url. I assumed that it either meant 2*38 or 2 to the power of 38 but I can't see how to put either of those in the url.What have I missed ?Thanks in advance.

Re: [Tutor] Python challenge

2006-05-06 Thread David Holland
Jason, Thanks that helped me work it out. David  Jason Massey <[EMAIL PROTECTED]> wrote: David,What answer did you get?  One of the things to rember on the challenge is to take your answer and put ".html" (no qutoes) on the end of it in the url.So for the first problem the ur

Re: [Tutor] Beginner question(s)

2006-06-19 Thread David Rock
I don't know if its still around or if it runs on modern > > PDAs - I think it was PalmOS anyhow... > > > > > > Pippy is quite dead. No development done recently. It supposedly runs > fine, but runs only Python 1.5. La

[Tutor] Escape sequences

2006-06-22 Thread David Heiser
x27;resetString']". Simple ASCII strings work fine, but the escape sequences don't work and the code fails. "print self.resetString" returns "\\03", instead of a nonprintable character. Any ideas? David Heiser ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Escape sequences

2006-06-22 Thread David Heiser
That worked just dandy. Thanks. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Johnson Sent: Thursday, June 22, 2006 1:03 PM Cc: tutor@python.org Subject: Re: [Tutor] Escape sequences David Heiser wrote: > I have code that assigns esc

Re: [Tutor] dictionary manipulation

2006-07-26 Thread David Heiser
Title: Message   Chris,   This looks similar to what I do for my job. I would be happy to help you, if I can.   My first question is, how would you like the output to look? Can you manually create a model of the email text you want to send?   My second question is, can you create the email

[Tutor] python

2006-08-08 Thread David Wilson
can you explain functions in python to me and give me some examples ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] <> and chomp

2006-09-14 Thread David Rock
is similar to chomp http://docs.python.org/lib/string-methods.html#l2h-201 These aren't exact matches, but they are close. -- David Rock [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] getting 'pwd' for XP ?

2006-09-28 Thread David Rock
ut found nothing suitable os.getcwd() http://docs.python.org/lib/os-file-dir.html -- David Rock [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Better way to substitute text?

2006-09-30 Thread David Heiser
You can make it simpler by not splitting the input file into lines. Treat it as a single string. in_put = open('test.html', 'r').read() replace_words = ['TWY', 'RWY', 'WIP'] for replace_word in replace_words: in_put = in_put.replace(replace_word, "" + replace_word + "")

[Tutor] Reading escaped characters from a file

2006-10-14 Thread David Heiser
Title: Message   I have code that uses variables to hold escaped characters like "\n" or "\03". As long as the assignment is done within the code, like self.crChar = "\n", there is no problem. But When I try to read the same character string from a text file and assign it, the string is seen

Re: [Tutor] Equivalent to perl -e

2006-10-16 Thread David Rock
x27; What you will notice is it gets complicated in a hurry if you try to do loops or anything fancy because of formatting constraints. Not that it can't be done, but it would hurt to try. :-) -- David Rock [EMAIL PROTECTED] ___ Tutor maillist

Re: [Tutor] Equivalent to perl -e

2006-10-16 Thread David Rock
simple in a shell script and didn't have a good way to get the date info I wanted, so I started playing around with python -e. It really SHOULD just be a python script that calls shell stuff, not the other way 'round :-) Still, in the spirit of the OP, I thought it would be approp

Re: [Tutor] Capture telnet output to a file?

2006-10-16 Thread David Heiser
Here is a snippet of code that may work for you: #--- import telnetlib HOST = "myServer" Username = "bob" Password = "fido" LoginList = ['=login:', '%s=password:' % (Username), '%s=$' % (Password)] ## Like an Expect script Terminator = "$" print "CONNECTING:" T

Re: [Tutor] Resources for Tkinter...

2006-10-19 Thread Feise, David
I really got a lot out of Thinking in Tkinter: http://www.ferg.org/thinking_in_tkinter/ It doesn’t delve too deeply, but it’s still a good resource.    This New Mexico Tech website is a good reference once you’ve got some of the basics: http://infohost.nmt.edu/tcc/help/pubs/tkinter/  

Re: [Tutor] getopt module..

2006-10-22 Thread David Rock
what you expect to see from them, then the for o, a in opts: section is used to replace default values with information from the commandline. -- David Rock [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Has anyone tried matplotlib...??

2006-10-23 Thread David Rock
hon user group) http://www.chipy.org meeting a few months ago. He's a great guy and he did some pretty impressive things with it. It also appears to interact well with ipython, an extremely powerful python interpreter shell (much better than the built-in shell) http://ipython.scipy.org/ -- Da

Re: [Tutor] I am terribly confused about "generators" and "iterators".. Help me

2006-10-27 Thread David Heiser
May I invite EVERYONE to NOT introduce political or religious elements into these discussions. It has no place here and can destroy this excellent discussion group. I've seen it happen. PLEASE take it elsewhere. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Beh

Re: [Tutor] Getting the screen size....using Tkinter

2006-12-04 Thread Feise, David
Try this: >>> from Tkinter import * >>> root = Tk() >>> root.winfo_screenwidth() 1280 >>> root.winfo_screenheight() 1024 >>> -Dave From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Asrarahmed Kadri Sent: Monday, December 04, 2006 8:44 AM To:

Re: [Tutor] Tutor Digest, Vol 35, Issue 16

2007-01-07 Thread David Seto
gt; 'help' to > [EMAIL PROTECTED] > > You can reach the person managing the list at > [EMAIL PROTECTED] > > When replying, please edit your Subject line so it > is more specific > than "Re: Contents of Tutor digest..." > > > Today's T

[Tutor] feeding data to subprocess exes and getting results without writing files

2007-01-09 Thread Barton David
Hi there, I can easily use the subprocess module to run a separate exe from within MyScript.py.. e.g. import subprocess process=subprocess.Popen("myprog.exe -i inputfile.txt -o outputfile.txt") ..and that's just fine as far as it goes, if I don't mind creating 'inputfile.txt' first, and reading

Re: [Tutor] feeding data to subprocess exes and getting results without writing files

2007-01-11 Thread Barton David
PROTECTED] On Behalf Of Christopher Arndt Sent: 09 January 2007 14:26 To: Tutor@python.org Subject: Re: [Tutor] feeding data to subprocess exes and getting results without writing files Barton David schrieb: > I just can't wrap my head around stdin, stdout and the whole pipes >

Re: [Tutor] 'elp!!!!!!!1Totally Clueless Newbie In Distress

2007-01-20 Thread David Rock
dy be in your path, so typing "python" at the propmt should result in it running the interpreter. If that works, exit the interpreter and type "python scriptname" That should run your script, and you will see the results in the command window because it won't close afte

[Tutor] Generating all possible hits of a regex pattern

2007-01-31 Thread Barton David
I don't suppose there's a nifty trick (exploiting the internal workings of the re module perhaps) to generate all possible hits of a given regex pattern? Something like: >>> import re >>> mypattern=re.compile( "[AB]C{1,2}D?" ) >>> print list( all_pattern_generator( mypattern ) ) ["AC","BC","ACC

Re: [Tutor] control multiple FTP sessions using multiple ipconnectionsvia different com ports

2007-02-19 Thread David Perlman
This kind of thing is usually handled at the level of the OS's routing table. Routing tables have an entry called "metric" that is used to weight the different routes, so that when there are multiple possible links available, the one with the lowest metric is used first. In Unix at least,

Re: [Tutor] Struct the solution for Hex translation

2007-02-19 Thread David Perlman
You're way off base... :) On Feb 19, 2007, at 9:25 AM, Johan Geldenhuys wrote: > Here is what I have: > data > '\xa5\x16\x0b\x0b\x00\xd5\x01\x01\x01\x00\x00\xe3\x84(\x01\xc6\x00 > \x00\x17\x > 01C\xc7' data[0] > '\xa5' len(data[0]) > 1 > > You see that data[0] is only one by

[Tutor] file.read() doesn't give full contents of compressed files

2007-02-20 Thread Barton David
Hi, I'm really confused, and I hope somebody can explain this for me... I've been playing with compression and archives, and have some .zip, .tar, .gz and .tgz example files to test my code on. I can read them using either zipfile, tarfile, gzip or zlib, and that's fine. But just reading them in

Re: [Tutor] file.read() doesn't give full contents of compressed files

2007-02-20 Thread Barton David
ead() from going to the end? Dave -Original Message- From: Kent Johnson [mailto:[EMAIL PROTECTED] Sent: 20 February 2007 12:53 To: Barton David Cc: tutor@python.org Subject: Re: [Tutor] file.read() doesn't give full contents of compressed files Barton David wrote: > Hi, > I

Re: [Tutor] file.read() doesn't give full contents of compressed files

2007-02-20 Thread Barton David
I see. Thanks for that. dave -Original Message- From: Kent Johnson [mailto:[EMAIL PROTECTED] Sent: 20 February 2007 13:30 To: Barton David Cc: tutor@python.org Subject: Re: [Tutor] file.read() doesn't give full contents of compressed files Barton David wrote: > Oh... of course

Re: [Tutor] Function for converting ints from base10 to base2?

2007-02-20 Thread David Perlman
I suspect the function I sent out earlier, using octal conversion and a lookup table, will be faster. But it would be very interesting to see some simple benchmarks. On Feb 20, 2007, at 10:47 PM, Dick Moores wrote: > I was surprised to be unable to find a function in Python for > converting

Re: [Tutor] Function for converting ints from base10 to base2?

2007-02-21 Thread David Perlman
234567890) > _t1 = _timer() > return _t1 - _t0 > """ > I get these results: > > for computeBin(12345678901234567890) > 1000 loops, best of 3: 448 usec per loop > > for computeBin(1234567890) > 1 loops, best of 3: 59.7 usec per loop > >

Re: [Tutor] geeks like us and the rest of THEM

2007-02-25 Thread David Perlman
Keep in mind that things generally become extremely reliable only after extensive real-world testing. TANSTAAFL On Feb 25, 2007, at 1:14 AM, Kirk Bailey wrote: > This has to be baby carriage reliable and simple for the business road > warrior who has not a geekified bone in their body. --

Re: [Tutor] Group sequence pairwise

2007-02-25 Thread David Perlman
I found this by "using Google". You should be able to make a simple modification (I can think of a couple of ways to do it) to have it pad the end with "None". It is 100% iterator input and output. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303279 On Feb 25, 2007, at 7:06 AM, C

Re: [Tutor] Telnet and special characters

2007-02-28 Thread David Perlman
This question isn't well posed. There is no such thing as an F1 "character". Data is sent over telnet connections as 8-bit bytes. You can send any combination of 8-bit bytes you want by coding them in a number of different ways, such as chr(xx) like you wrote below, or '\xnn' or whatever

Re: [Tutor] Two sys.exit questions

2007-02-28 Thread David Perlman
If you want to play around with this stuff, you can first import sys, and then insert this line in the except clause: print repr(sys.exc_info()) (or some other way of getting the details out of the returned tuple.) That will tell you exactly what brought you to the except clause. On Feb 28, 200

[Tutor] using tarfile on strings or filelike objects

2007-03-02 Thread Barton David
I like that I can access the contents of a zip archive that's stored in memory (rather than on disk) by packing the archive contents into a StringIO or cStringIO object and feeding that to ZipFile... i.e. filelike=cStringIO.StringIO(archive_as_string) zf=zipfile.ZipFile(filelike) content=zf.re

Re: [Tutor] Yet another list comprehension question

2007-03-02 Thread David Perlman
On Mar 2, 2007, at 9:56 AM, Alan Gauld wrote: > Why not use a Set? > > s = Set([somefun(i) for i in some-iterator]) > > Might be slow for big lists though... I'm curious why using a Set would be slower than doing it in a loop? In either case, the processor has to scan through all the data l

Re: [Tutor] using tarfile on strings or filelike objects

2007-03-05 Thread Barton David
.getmember(archive_member_name) >>>tf_filelike=tf.extractfile(tf_infoobject) >>>print tf_filelike.read() In fact I'm getting this even if I open the archive by passing the path name (rather than using fileobj) so I guess this isn't the problem I initially thought it wa

Re: [Tutor] using tarfile on strings or filelike objects

2007-03-05 Thread Barton David
l in response to a tutor's direct reply) it doesn't seem to add my message to the bottom of the existing thread. If somebody can tell me what I'm doing wrong, I'd appreciate it. -Original Message- From: Kent Johnson [mailto:[EMAIL PROTECTED] Sent: 05 March 2007 12:44

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread David Perlman
OK, I'm new to python too so I don't assume I know what I'm talking about yet, but this looks like a mess to me. What exactly does "item == item in word2" evaluate to? Does "in" or "==" have higher precedence? I can't figure out how this would ever work at all. It seems like it's either

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread David Perlman
On Mar 6, 2007, at 11:03 AM, Alan Gauld wrote: > It's doing the latter and since anything that's not 'empty' in > Python evaluates to true we wind up checking whether > true == (item in word) > > So if the item is in word we get true == true which is true. > > HTH, Sorry, but this still doesn't ma

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread David Perlman
On Mar 6, 2007, at 4:28 PM, wesley chun wrote: >> >>> x=('i' in 'i') >> >>> x >> True >> >>> y='i' >> >>> x==y >> False > > you're right when you talk about "casting" altho that's not what > python does. it merely performs an object value comparison when you > use '=='. for example, change

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread David Perlman
I think it's a little strange and possibly problematic that type(1) is 'int' and type(True) is 'bool' but 1 == True specifically evaluates to True even though anything else, even if it evaluates to True when cast as a boolean, is not == True. >>> 1 == True True >>> 2 == True False >>> 0 ==

Re: [Tutor] tokenizing a simple string with split()

2007-03-31 Thread David Heiser
Or you can try something like: x = r"C:\My\Doc\;D:\backup" x = x.replace("\\", ";") x = x.split(";") -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Johnson Sent: Saturday, March 31, 2007 9:42 PM To: Andrei Petre Cc: tutor@python.org Subject: Re: [

[Tutor] Interactive plots...

2008-03-27 Thread David Perlman
I am thinking about writing a program which will involve, among other things, displaying a plot of a series of numbers. The idea is that you could click on the points and move them to change the numbers. Reverse-plotting, I suppose. It need not be complex; the numbers will all be zero or

[Tutor] Beginner issue with Tkinter Listbox

2008-09-03 Thread David Johnson
I have just started learning Python and have moved on to learning about Tkinter. This is likely to be a very easy question but I have no idea what is happening here. I am trying to set up a GUI, separated into several frames. In a lower frame I have added a Listbox. I want the first item

[Tutor] Idle and windows XP firewall

2008-10-01 Thread David Holland
At work I have windows XP service pack 3 and although I have sys admin I can not use idle. I have googled but no success - any ideas? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Idle and windows XP firewall

2008-10-01 Thread David Holland
IL PROTECTED] Date: Wednesday, 1 October, 2008, 11:35 AM On Wed, Oct 1, 2008 at 5:04 AM, David Holland <[EMAIL PROTECTED]> wrote: > At work I have windows XP service pack 3 and although I have sys admin I can > not use idle. > I have googled but no success - any ideas?

Re: [Tutor] Idle and windows XP firewall

2008-10-02 Thread David Holland
I am using python 2.5.2.  Is there an alternative to idle that does not have this problem? (I also fixed that this was no longer a problem). ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Idle and windows XP firewall

2008-10-02 Thread David Holland
hon.org Date: Thursday, 2 October, 2008, 4:53 PM On Thu, Oct 2, 2008 at 10:31 AM, David Holland <[EMAIL PROTECTED]> wrote: I am using python 2.5.2.  Is there an alternative to idle that does not have this problem? (I also fixed that this was no longer a problem). Open IDLE witho

Re: [Tutor] Idle and windows XP firewall

2008-10-02 Thread David Holland
ROTECTED] Cc: tutor@python.org Date: Thursday, 2 October, 2008, 5:01 PM Where are you running it from?  it needs some weird command line parameters, so you probably need to use the shortcut in the start bar that Python made for you. On Thu, Oct 2, 2008 at 10:55 AM, David Holland <[EMAIL PROTECTE

Re: [Tutor] Idle and windows XP firewall

2008-10-02 Thread David Holland
win, it's an editor by the guy that made the win32all extensions. Or use eclipse with Python plugin, maybe? On Thu, Oct 2, 2008 at 11:31 AM, David Holland <[EMAIL PROTECTED]> wrote: I just using the short cut and nothing happens :(. I have managed to do this before just not in my ne

[Tutor] stable algorithm

2008-12-14 Thread David Hláčik
Hi guys, i am really sorry for making offtopic, hope you will not kill me, but this is for me life important problem which needs to be solved within next 12 hours.. I have to create stable algorithm for sorting n numbers from interval [1,n^2] with time complexity O(n) . Can someone please give m

Re: [Tutor] stable algorithm

2008-12-14 Thread David Hláčik
> > Does that mean its homework? > Hi, yes it is homework , this is result : #! /usr/bin/python def sort(numbers): "sort n positive integers in O(n) provided that they are all < n^2" N = len(numbers) # get size of test numbers buckets_mod = [[] for i in xrange(N)]

Re: [Tutor] stable algorithm

2008-12-14 Thread David Hláčik
> def sort(numbers): >"sort n positive integers in O(n) provided that they are all < n^2" Sorry about wrong comment, should be range from [1 to n^2] not only < n^2. D. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listin

Re: [Tutor] stable algorithm

2008-12-14 Thread David Hláčik
auld wrote: > "David Hlácik" wrote > >> yes it is homework , this is result : >> >> #! /usr/bin/python >> def sort(numbers): >> "sort n positive integers in O(n) provided that they are all < n^2" >> N = len(numbers) # get

[Tutor] linked list with cycle structure

2009-01-07 Thread David Hláčik
of elements** of such linked list. Yes , maybe it sounds strange, but we need to implement this and i would be very gladfull for your toughts. Thanks in advance and wishing you a sucessfull year! David ___ Tutor maillist - Tutor@python.org http

Re: [Tutor] linked list with cycle structure

2009-01-07 Thread David Hláčik
helping memory with constant size* ? This means i am not able to create any set and adding elements there. I need to have a constant size variables . This is complication a complication for me. Thanks in advance! David On Wed, Jan 7, 2009 at 2:22 PM, Diez B. Roggisch wrote: > > David

Re: [Tutor] linked list with cycle structure

2009-01-08 Thread David Hláčik
on 2- 3, 6 iteration 3- 4, 8 iteration 4- 5, 5 ( match) But how can this help me with counting list elements? :( Thanks, D. On Thu, Jan 8, 2009 at 5:48 PM, Diez B. Roggisch wrote: > > David Hláčik wrote: > > > Hi, > > > > so okay, i will create a helping set, where i will be

[Tutor] Non-blocking non-interactive graphics display

2009-01-14 Thread David Williams
Hi All, I am still getting my python legs (similar to sea legs but more scale-y) and ran across a decision that I'd like some advice on. I am looking for the simplest way of displaying a little positional data as a line graphic in a window as a script runs. Something like: #Set up some

Re: [Tutor] using a networked data file

2010-12-11 Thread David Hutto
On Fri, Dec 10, 2010 at 10:23 PM, Bill Allen wrote: > This is somewhat non-Python specific   I have an idea for a Python > application that I want to write at work.  The application needs to have a > data file be available to multiple users for access, read and write.   I > know that a typical dat

Re: [Tutor] Slicing Tuples

2010-12-11 Thread David Hutto
So, in essence, that would be redefining(in Python) basic division of grammatical structures(splices)? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] role playing game - help needed

2010-12-11 Thread David Hutto
On Sat, Dec 11, 2010 at 11:54 AM, Lie Ryan wrote: > On 12/07/10 23:37, Robert Sjöblom wrote: >> I've been told to use input() if I know that I'll only get integers, >> and raw_input() for "everything." > > That is a bad piece of advice. You should only use input() when you can > fully trust whoeve

Re: [Tutor] Ressources for licensing

2010-12-11 Thread David Hutto
On Sat, Dec 11, 2010 at 9:52 AM, Knacktus wrote: > Hi everyone, > > can anybody recommend a lib or some other ressources about license > mechanisms of desktop applications written in python. I'm thinking of a > license-key that can be used to limit the time the application can be used. > I also ne

Re: [Tutor] role playing game - help needed

2010-12-12 Thread David Hutto
On Sat, Dec 11, 2010 at 10:39 PM, Steven D'Aprano wrote: > David Hutto wrote: >> >> On Sat, Dec 11, 2010 at 11:54 AM, Lie Ryan wrote: >>> >>> On 12/07/10 23:37, Robert Sjöblom wrote: >>>> >>>> I've been told to use inpu

Re: [Tutor] Ressources for licensing

2010-12-12 Thread David Hutto
You need a file that sets the initial time used for the app(the time on the individuals computer), and a function that checks that initial start up file for the current time and the original usage time of first start up. ___ Tutor maillist - Tutor@pytho

Re: [Tutor] Ressources for licensing

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 2:27 PM, David Hutto wrote: > You need a file that sets the initial time used for the app(the time > on the individuals computer), and a function that checks that initial > start up file for the current time and the original usage time of > first start up. &

Re: [Tutor] Ressources for licensing

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 2:32 PM, David Hutto wrote: > On Sun, Dec 12, 2010 at 2:27 PM, David Hutto wrote: >> You need a file that sets the initial time used for the app(the time >> on the individuals computer), and a function that checks that initial >> start up file for the

Re: [Tutor] role playing game - help needed

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 2:16 PM, David Hutto wrote: > On Sat, Dec 11, 2010 at 10:39 PM, Steven D'Aprano wrote: >> David Hutto wrote: >>> >>> On Sat, Dec 11, 2010 at 11:54 AM, Lie Ryan wrote: >>>> >>>> On 12/07/10 23:37, Robert Sjöblom wr

Re: [Tutor] role playing game - help needed

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 2:44 PM, Walter Prins wrote: > > > On 12 December 2010 19:16, David Hutto wrote: >> >>  I recall you making a habit of being an >> asshole(pystats should ring a bell, thanks for giving me the credit >> for inspiration...bitch) > > Ru

Re: [Tutor] role playing game - help needed

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 2:45 PM, David Hutto wrote: > On Sun, Dec 12, 2010 at 2:44 PM, Walter Prins wrote: >> >> >> On 12 December 2010 19:16, David Hutto wrote: >>> >>>  I recall you making a habit of being an >>> asshole(pystats should ring

Re: [Tutor] Code evaluation inside of string fails with __get_item

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 2:42 PM, Tim Johnson wrote: > * Steven D'Aprano [101211 17:20]: >> Tim Johnson wrote: >> >>>   I've never had the occasion to use assert() or any other >>>   python - shooting tools, any thoughts on that? >> >> >> Assertions are a great tool, but never ever, under pain of

Re: [Tutor] role playing game - help needed

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 2:45 PM, David Hutto wrote: > On Sun, Dec 12, 2010 at 2:45 PM, David Hutto wrote: >> On Sun, Dec 12, 2010 at 2:44 PM, Walter Prins wrote: >>> >>> >>> On 12 December 2010 19:16, David Hutto wrote: >>>> >>>>  

Re: [Tutor] Tutor Digest, Vol 82, Issue 54

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 11:43 PM, marupalli charan wrote: > dont send me mails again. i want to unsubscript ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] looking for python or django SQL data editor

2010-12-18 Thread David Hutto
On Sat, Dec 18, 2010 at 7:45 PM, Len Conrad wrote: > phpmyadmin and other such mysql db design/maintain tools do too much, too > complicated. > > I'm looking for a python or django web app that allows non-tech users to > add/delete/search records. You'll probably find the same here. A bunch of

Re: [Tutor] Problem with print

2010-12-19 Thread David Hutto
On Sun, Dec 19, 2010 at 4:05 PM, Alex Hall wrote: > Sorry to top-post (gMail mobile). > This looks like you missed a quote, colon, or something on a line > elsewhere in the file (likely above it). Find that and this should be > fixed. > > On 12/19/10, jtl999 wrote: >>  File "GettingStarted.py", l

Re: [Tutor] Problem with print

2010-12-19 Thread David Hutto
Two" >> >> Python 3.X >> print("Lesson Two") >> >> Either find a version of the howto for 2 or install python 3. >> > > Alex is right, David and Sander judged too quickly: > > Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39) > [GCC 4.4.5]

Re: [Tutor] Problem with print

2010-12-20 Thread David Hutto
On Mon, Dec 20, 2010 at 5:15 AM, Steven D'Aprano wrote: > David Hutto wrote: >> >> On Sun, Dec 19, 2010 at 4:33 PM, Hugo Arts wrote: >>> >>> On Sun, Dec 19, 2010 at 10:11 PM, Sander Sweers >>> wrote: >>>> >>>> On 19 December

Re: [Tutor] Problem with print

2010-12-20 Thread David Hutto
> > Note that print can actually only be used as a statement in python 2. > It just so happens that you can include parentheses in the statement. > Though that makes it look similar to a function call, it certainly is > not. You'll see that when you try to supply multiple arguments to the > "functi

Re: [Tutor] Trying to parse a HUGE(1gb) xml file in python

2010-12-21 Thread David Hutto
parse a ginormous ( ~ 1gb) xml file. >> >> I sympathize with you. I wonder who thought that building a 1GB XML file >> was a good thing. David Mertz, Ph.D. Comparator, Gnosis Software, Inc. June 2003 http://gnosis.cx/publish/programming/xml_matters_29.html that was just the first lis

Re: [Tutor] Trying to parse a HUGE(1gb) xml file in python

2010-12-21 Thread David Hutto
But then again, maybe it's too much of an optimization for someone not optimizing for others or a specific application for the hardware, or it's not part of the standard python library, and therefore, expendable. ___ Tutor maillist - Tutor@python.org To

<    2   3   4   5   6   7   8   9   10   11   >