Re: [Tutor] list method help

2006-02-02 Thread Chris or Leslie Smith
| Hello, | was just trying to do something and tried the following code: | | list = ["1", "test", "1.5"] | | for x in list: | print list.pop(x) | | I get the following error: | | print list.pop(x) | TypeError: an integer is required | | Does this mean i can't use a for loop to po

Re: [Tutor] list method help

2006-02-02 Thread Danny Yoo
On Thu, 2 Feb 2006, Michael Haft wrote: > was just trying to do something and tried the following code: > > list = ["1", "test", "1.5"] > > for x in list: > print list.pop(x) > > I get the following error: > > print list.pop(x) > TypeError: an integer is required Hi Michael, Th

Re: [Tutor] critique my wrapper

2006-02-02 Thread Andre Roberge
On 2/2/06, Christopher Spears <[EMAIL PROTECTED]> wrote: > This is a class I created that wraps a list. Could > someone please critique the class? > > class MyList: > def __init__(self, aList=None): > if aList is None: > self.mylist = [] >

Re: [Tutor] list method help

2006-02-02 Thread Alan Gauld
> list = ["1", "test", "1.5"] > for x in list: > print list.pop(x) > > I get the following error: > > print list.pop(x) > TypeError: an integer is required > > Does this mean i can't use a for loop to pop things from a list? No it means pop takes an optional *index* as an argument. > list

[Tutor] critique my wrapper

2006-02-02 Thread Christopher Spears
This is a class I created that wraps a list. Could someone please critique the class? class MyList: def __init__(self, aList=None): if aList is None: self.mylist = [] else: self.mylist = aList[:] def _

[Tutor] list method help

2006-02-02 Thread Michael Haft
Hello, was just trying to do something and tried the following code: list = ["1", "test", "1.5"] for x in list: print list.pop(x) I get the following error: print list.pop(x) TypeError: an integer is required Does this mean i can't use a for loop to pop things from a list? or

Re: [Tutor] Todays Learning Python Question From a Newbie ;)

2006-02-02 Thread Andre Roberge
As I indicated in private email yesterday to Jon, there is indeed a hole in the computer stratey when the following three first moves are made: x:2 o:4 (first available "best move" for the computer) x:7 I also sketched a "solution", which I will rephrase here in a different way. The next "best m

Re: [Tutor] Todays Learning Python Question From a Newbie ;)

2006-02-02 Thread Jon Moore
All that does is reverse the hole!?!?x:2o:4x:7o:0x:80:5    O |   | X    -      | O | O    -      | X | X On 02/02/06, Wolfram Kraus <[EMAIL PROTECTED]> wrote: Jon Moore wrote:[...]> Thanks to  André, there is a way to win every time if you take the first> move (see below), so there

[Tutor] Trapping a Dr Watson error

2006-02-02 Thread Ben Vinger
Hello I have a script based on: http://aspn.activestate.com/ASPN/docs/ActivePython/2.4/pywin32/Windows_NT_Eventlog.html It collects eventlogs data from many Windows servers. I know how to handle normal Python Tracebacks, but my script bombs out with a Dr Watson error when connecting to one particu

Re: [Tutor] Todays Learning Python Question From a Newbie ;)

2006-02-02 Thread Wolfram Kraus
Jon Moore wrote: [...] > Thanks to André, there is a way to win every time if you take the first > move (see below), so there MUST be a whole in the computers stratergy! > Based on what we all know about the game, I would say that you can not > make it so that the computer can win every time,

Re: [Tutor] Windows problem with large(?) files

2006-02-02 Thread johan nilsson
Thanks Danny!that solved it.JohanOn 2/2/06, Danny Yoo <[EMAIL PROTECTED]> wrote: On Thu, 2 Feb 2006, johan nilsson wrote:> apparently the XP box thinks the file is alot shorter, and that can't be > as it is the same file from the same media (USB stick). What is going> wrong here?Hi Johan,Is it poss

[Tutor] Using ioctl

2006-02-02 Thread Michael Lange
Hello, I am writing an app that records from the soundcard using ossaudiodev. In the OSS programmer's guide they recommend when reading data fragments from the soundcard to use the fragment size as it is requested by the driver. According to the programmer's guide the ioctl call to determine the

Re: [Tutor] printing the random seed?

2006-02-02 Thread Kent Johnson
Danny Yoo wrote: > > On Thu, 2 Feb 2006, kevin parks wrote: > > >>Danny (hope you are good!) & co, >> >>I see that biz about random.seed()... but in the absence of setting that >>... does it just grab a value from the system clock? > > > Yes. Here's what the documentation says officially: >

Re: [Tutor] Windows problem with large(?) files

2006-02-02 Thread Danny Yoo
On Thu, 2 Feb 2006, johan nilsson wrote: > apparently the XP box thinks the file is alot shorter, and that can't be > as it is the same file from the same media (USB stick). What is going > wrong here? Hi Johan, Is it possible that you need to treat the file as a binary file? It's rare, but

Re: [Tutor] Todays Learning Python Question From a Newbie ;)

2006-02-02 Thread Jon Moore
On 02/02/06, Alan Gauld <[EMAIL PROTECTED]> wrote: Bob,>> Write a new computer_move() function for the tic-tac-toe game to plug>> the hole in the computers stratergy. See if you can create an opponent>> that is unbeatable!>> >> My main problem is that I can not see how the computers stratergy can>>

Re: [Tutor] need to get unique elements out of a 2.5Gb file

2006-02-02 Thread Alan Gauld
Hi, < I have a file which is 2.5 Gb., > > There are many duplicate lines. I wanted to get rid > of the duplicates. First, can you use uniq which is a standard Unix/Linux OS command? > I chose to parse to get uniqe element. > > f1 = open('mfile','r') > da = f1.read().split('\n') This reads 2

Re: [Tutor] Todays Learning Python Question From a Newbie ;)

2006-02-02 Thread Alan Gauld
Bob, >> Write a new computer_move() function for the tic-tac-toe game to plug >> the hole in the computers stratergy. See if you can create an opponent >> that is unbeatable! >> >> My main problem is that I can not see how the computers stratergy can >> be improved as at best I can only manage

Re: [Tutor] need to get unique elements out of a 2.5Gb file

2006-02-02 Thread Rinzwind
I'd use a database if I was you. Install for instance MYSQL or MudBase or something like that and (if need be use Python) to insert the lines into the database. Only storing unique lines would be failry easy. Other sollution (with the usage of Python): If you must use Python I'd suggest making new

[Tutor] Windows problem with large(?) files

2006-02-02 Thread johan nilsson
Dear group,I have a few files that contains data in IEEE 754 format. I need to transform them into a csv file, to be able to read these files in another program. Each file has 3 samples of I and Q. I did develop the attached script. I am sure not the best, but it worked at home on my Linux inst