Re: [Tutor] string to list

2010-02-10 Thread Owain Clarke
With thanks to all who made suggestions, this was what I settled on f = open('testfile') #(testfile consisting of 2 columns of data, as per Kent's suggestion) data = [] for line in f: line_data = [int(x) for x in line.split()] data.append(line_data) data.sort(key=lambda x:x[0]) print "sort by f

Re: [Tutor] Compile py to exe in ubuntu

2010-02-10 Thread Chris Fuller
Using freeze or another tool of its ilk is only going to make you an executable for that platform. If you want an executable for a different platform, you need to set up a native Python environment with all the dependencies installed where Python can find them, and then use that platform's to

Re: [Tutor] packing up python code to transfer to another machine

2010-02-10 Thread Chris Fuller
There are two obvious "gotchas". One is binary extensions. If you are using modules that are not "pure Python", you will have to find *nux versions for your target. The other problem is impossible to solve in general, but most of the time, it's less trouble than the first problem. Python is

Re: [Tutor] Compile py to exe in ubuntu

2010-02-10 Thread Harya Dananjaya
On 11/02/10 04:56, Grigor Kolev wrote: Use cx_freeze but you cannot make exe in ubuntu must use Windows OK, I have installed cx_freeze on my windows, but when I compile with cx_freeze, it generate error : ---Begin error

Re: [Tutor] Compile py to exe in ubuntu

2010-02-10 Thread Harya Dananjaya
On 11/02/10 04:49, vince spicer wrote: 1. Ubuntu and linux in general don't use exe per say 2. Python can be compiled but not usually in the way you are thinking 3. you might check out http://pypi.python.org/pypi/bbfreeze/ Vince 1.Yupe, I know ubuntu don't use exe file. I have windows too, bu

Re: [Tutor] Compile py to exe in ubuntu

2010-02-10 Thread Harya Dananjaya
On 11/02/10 04:47, Wayne Werner wrote: Do you mean a windows executable? Not really. Why do you want an .exe anyway? Python code is (usually) cross-platform. -Wayne Yupe, Yupe, python is cross platform, but we need install python in every computer we want to using the pyththon *.py . Hary

Re: [Tutor] running split and count + looping to check for numbers in same line

2010-02-10 Thread jim serson
Thanks for the information > Date: Wed, 10 Feb 2010 21:50:53 -0500 > Subject: Re: [Tutor] running split and count + looping to check for numbers > in same line > From: ken...@tds.net > To: fubarni...@hotmail.com > CC: tutor@python.org > > On Wed, Feb 10, 2010 at 6:43 PM, jim serson wrote: > >

Re: [Tutor] running split and count + looping to check for numbers in same line

2010-02-10 Thread Kent Johnson
On Wed, Feb 10, 2010 at 6:43 PM, jim serson wrote: > I am getting an error when I try and run split and count I seem to get it to > work with one or the other but not together. python wants a character buffer > but I am not sure how to use it. > > I would also like to use readline to check and see

[Tutor] packing up python code to transfer to another machine

2010-02-10 Thread dwbarne
I have become a true Pythonaholic. My newest problem is I have a rather large Python code (1.5yrs + developing!) currently running on Windows machines that imports several modules, some from external libraries. It allows the user to easily access MySQL databases and plot selected columns and

Re: [Tutor] html and python

2010-02-10 Thread Benno Lang
On Thu, Feb 11, 2010 at 5:26 AM, Grigor Kolev wrote: > I apologize to my question is incorrectly set. > We have a mail list and we want to do in site a list of all participants > with their photos and names. > List with people is saved in the txt file. > I want to open this file. Take all mail add

[Tutor] running split and count + looping to check for numbers in same line

2010-02-10 Thread jim serson
I am getting an error when I try and run split and count I seem to get it to work with one or the other but not together. python wants a character buffer but I am not sure how to use it. I would also like to use readline to check and see if several numbers are in the same line but I think

Re: [Tutor] need idea

2010-02-10 Thread Andre Engels
On Thu, Feb 11, 2010 at 12:12 AM, invincible patriot wrote: > thanks > let me clear you that what i am trying to do > suppose we hav a input string and a dict > our_dict={'a':'u', 't':'a', 'c':'g', 'g':'c'} > input_string='atcg' > > > now what i wana do is that where ever we are having 'a' i wana

Re: [Tutor] need idea

2010-02-10 Thread invincible patriot
thanks let me clear you that what i am trying to do suppose we hav a input string and a dict our_dict={'a':'u', 't':'a', 'c':'g', 'g':'c'} input_string='atcg' now what i wana do is that where ever we are having 'a' i wana replace it with 'u', 't' with 'a' and so on i tried using input_string.r

Re: [Tutor] need idea

2010-02-10 Thread Andre Engels
On Wed, Feb 10, 2010 at 10:27 PM, invincible patriot wrote: > hi > i want to compare a string with a dictionary > or u can say that i want to take user input A STRING, and want to compare > each character of that string with the KEYS  in the dictionary, and then i > wana print the values for the c

Re: [Tutor] need idea

2010-02-10 Thread Kent Johnson
On Wed, Feb 10, 2010 at 4:27 PM, invincible patriot wrote: > hi > i want to compare a string with a dictionary > or u can say that i want to take user input A STRING, and want to compare > each character of that string with the KEYS  in the dictionary, and then i > wana print the values for the ch

Re: [Tutor] Needleman-Wunsch algorithm

2010-02-10 Thread Wayne Werner
On Wed, Feb 10, 2010 at 3:29 PM, invincible patriot < invincible_patr...@hotmail.com> wrote: > hi > i hope every one knows about the needleman wunsch algo > Never heard of it > i am trying to do the same task, > can some one give me an outline as to how should i start after taking 2 > input st

[Tutor] Needleman-Wunsch algorithm

2010-02-10 Thread invincible patriot
hi i hope every one knows about the needleman wunsch algo i am trying to do the same task, can some one give me an outline as to how should i start after taking 2 input strings from the user.. ___

[Tutor] need idea

2010-02-10 Thread invincible patriot
hi i want to compare a string with a dictionary or u can say that i want to take user input A STRING, and want to compare each character of that string with the KEYS in the dictionary, and then i wana print the values for the characters that are present in that strinng that we got as the input

Re: [Tutor] html and python

2010-02-10 Thread Grigor Kolev
В 15:02 -0500 на 10.02.2010 (ср), Kent Johnson написа: > On Wed, Feb 10, 2010 at 2:54 PM, Grigor Kolev wrote: > > В 14:39 -0500 на 10.02.2010 (ср), Kent Johnson написа: > >> On Wed, Feb 10, 2010 at 2:30 PM, Grigor Kolev > >> wrote: > >> > Hi. > >> > I want to make a list of E-mail, photos and so

Re: [Tutor] html and python

2010-02-10 Thread Kent Johnson
On Wed, Feb 10, 2010 at 2:54 PM, Grigor Kolev wrote: > В 14:39 -0500 на 10.02.2010 (ср), Kent Johnson написа: >> On Wed, Feb 10, 2010 at 2:30 PM, Grigor Kolev wrote: >> > Hi. >> > I want to make a list of E-mail, photos and some additional data. >> > But I want this list to be displayed in one si

Re: [Tutor] Compile py to exe in ubuntu

2010-02-10 Thread Grigor Kolev
В 04:40 +0900 на 11.02.2010 (чт), Harya Dananjaya написа: > Can I compile my python source to exe in ubuntu? > if I can do it, which compiler can do it? > > Thanks you, > > Harya Dananjaya > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe

Re: [Tutor] Compile py to exe in ubuntu

2010-02-10 Thread Wayne Werner
On Wed, Feb 10, 2010 at 1:40 PM, Harya Dananjaya wrote: > Can I compile my python source to exe in ubuntu? > if I can do it, which compiler can do it? > > Thanks you, > > Harya Dananjaya > Do you mean a windows executable? Not really. Why do you want an .exe anyway? Python code is (usually) cross

Re: [Tutor] Compile py to exe in ubuntu

2010-02-10 Thread vince spicer
On Wed, Feb 10, 2010 at 1:40 PM, Harya Dananjaya wrote: > Can I compile my python source to exe in ubuntu? > if I can do it, which compiler can do it? > > Thanks you, > > Harya Dananjaya > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or c

Re: [Tutor] html and python

2010-02-10 Thread Grigor Kolev
В 13:33 -0600 на 10.02.2010 (ср), vince spicer написа: > On Wed, Feb 10, 2010 at 1:30 PM, Grigor Kolev > wrote: > Hi. > I want to make a list of E-mail, photos and some additional > data. > But I want this list to be displayed in one site. > How can I send d

Re: [Tutor] html and python

2010-02-10 Thread vince spicer
On Wed, Feb 10, 2010 at 1:30 PM, Grigor Kolev wrote: > Hi. > I want to make a list of E-mail, photos and some additional data. > But I want this list to be displayed in one site. > How can I send data from a list of site page. Which module should I use > -- > Grigor Kolev > >

[Tutor] Compile py to exe in ubuntu

2010-02-10 Thread Harya Dananjaya
Can I compile my python source to exe in ubuntu? if I can do it, which compiler can do it? Thanks you, Harya Dananjaya ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] html and python

2010-02-10 Thread Kent Johnson
On Wed, Feb 10, 2010 at 2:30 PM, Grigor Kolev wrote: > Hi. > I want to make a list of E-mail, photos and some additional data. > But I want this list to be displayed in one site. > How can I send data from a list of site page. Which module should I use I don't understand "send data from a list of

Re: [Tutor] html and python

2010-02-10 Thread vince spicer
On Wed, Feb 10, 2010 at 1:30 PM, Grigor Kolev wrote: > Hi. > I want to make a list of E-mail, photos and some additional data. > But I want this list to be displayed in one site. > How can I send data from a list of site page. Which module should I use > -- > Grigor Kolev > >

[Tutor] html and python

2010-02-10 Thread Grigor Kolev
Hi. I want to make a list of E-mail, photos and some additional data. But I want this list to be displayed in one site. How can I send data from a list of site page. Which module should I use -- Grigor Kolev ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] string to list

2010-02-10 Thread Owain Clarke
If you mean the external shell (say, "bash" under Linux or the DOS command line in Windows, or similar) then you can only input strings -- everything is a string in such shells. Yes, I meant capturing data from bash There are two ways to conv

Re: [Tutor] string to list

2010-02-10 Thread Stefan Behnel
Owain Clarke, 10.02.2010 14:32: >> You may want to add a little bit about your use case. Is that really >> the input you >> have to deal with? Where does it come from? Can you control the >> format? What do >> you want to do with the list you extract from the string? >> >> All of that may have an i

Re: [Tutor] string to list

2010-02-10 Thread Eike Welk
On Wednesday February 10 2010 14:32:52 Owain Clarke wrote: > My son was doing a statistics project in which he had to sort some data by > either one of two sets of numbers, representing armspan and height of a > group of children - a boring and painstaking job. I came across this > piece of cod

Re: [Tutor] string to list

2010-02-10 Thread Kent Johnson
On Wed, Feb 10, 2010 at 8:32 AM, Owain Clarke wrote: > My son was doing a statistics project in which he had to sort some data by > either one of two sets of numbers, representing armspan and height of a > group of children - a boring and painstaking job.  I came across this piece > of code:- > >

Re: [Tutor] string to list

2010-02-10 Thread Steven D'Aprano
On Thu, 11 Feb 2010 12:32:52 am Owain Clarke wrote: > My son was doing a statistics project in which he had to sort some > data by either one of two sets of numbers, representing armspan and > height of a group of children - a boring and painstaking job. I came > across this piece of code:- > > l

Re: [Tutor] NameError: global name 'celsius' is not defined (actually, solved)

2010-02-10 Thread Dave Angel
David wrote: Hello Wesley, thanks for your reply. I was surprised about the limited information too. Sadly (?), I can't reproduce the error any more... David On 10/02/10 11:13, wesley chun wrote: I just wrote this message, but after restarting ipython all worked fine. How is it to be exp

Re: [Tutor] string to list

2010-02-10 Thread Owain Clarke
Owain Clarke wrote: Please excuse the obviousness of my question (if it is), but I have searched the documentation for how to generate a list e.g. [(1,2), (3,4)] from a string "[(1,2), (3,4)]". I wonder if someone could point me in the right direction. Many thanks Owain Clarke Th

Re: [Tutor] string to list

2010-02-10 Thread Kent Johnson
On Wed, Feb 10, 2010 at 6:26 AM, Owain Clarke wrote: > Please excuse the obviousness of my question (if it is), but I have searched > the documentation for how to generate a list e.g. [(1,2), (3,4)] from a > string "[(1,2), (3,4)]". I wonder if someone could point me in the right > direction. Pyt

Re: [Tutor] string to list

2010-02-10 Thread Stefan Behnel
Owain Clarke, 10.02.2010 13:34: > I have solved it myself - must search more before posting! > > If anyone at my kind of level is interested:- > mystring = "[(1,2), (3,4)]" mylist = eval(mystring) mylist > [(1,2), (3,4)] type(mylist) > As others have pointed out, this may or

Re: [Tutor] "Error :Attempt to overwrite cell" while using xlwt to create excel sheets

2010-02-10 Thread Kent Johnson
On Wed, Feb 10, 2010 at 6:47 AM, nikunj badjatya wrote: > I commented out the "raise Exception" statement in Row.py library > module. > Here's the (line no. 150 ) of Row.py which i have edited: > >   def insert_cell(self, col_index, cell_obj): >         if col_index in self.__cells: >            

Re: [Tutor] NameError: global name 'celsius' is not defined (actually, solved)

2010-02-10 Thread Kent Johnson
On Tue, Feb 9, 2010 at 10:00 PM, David wrote: > Hi guys, > > I just wrote this message, but after restarting ipython all worked fine. > How is it to be explained that I first had a namespace error which, after a > restart (and not merely a new "run Sande_celsius-main.py"), went away? I > mean, sur

Re: [Tutor] string to list

2010-02-10 Thread Owain Clarke
I have solved it myself - must search more before posting! If anyone at my kind of level is interested:- >>> mystring = "[(1,2), (3,4)]" >>> mylist = eval(mystring) >>> mylist [(1,2), (3,4)] >>> type(mylist) Thanks Owain Clarke wrote: Please excuse the obviousness of my question (if it is), b

Re: [Tutor] string to list

2010-02-10 Thread Stefan Behnel
Owain Clarke, 10.02.2010 12:26: > Please excuse the obviousness of my question (if it is), but I have > searched the documentation for how to generate a list e.g. [(1,2), > (3,4)] from a string "[(1,2), (3,4)]". I wonder if someone could point > me in the right direction. You may want to add a lit

Re: [Tutor] string to list

2010-02-10 Thread Jose Amoreira
On Wednesday 10 February 2010 11:26:25 am Owain Clarke wrote: > Please excuse the obviousness of my question (if it is), but I have > searched the documentation for how to generate a list e.g. [(1,2), > (3,4)] from a string "[(1,2), (3,4)]". I wonder if someone could point > me in the right directi

Re: [Tutor] string to list

2010-02-10 Thread Christian Witts
Owain Clarke wrote: Please excuse the obviousness of my question (if it is), but I have searched the documentation for how to generate a list e.g. [(1,2), (3,4)] from a string "[(1,2), (3,4)]". I wonder if someone could point me in the right direction. Many thanks Owain Clarke _

Re: [Tutor] string to list

2010-02-10 Thread spir
On Wed, 10 Feb 2010 11:26:25 + Owain Clarke wrote: > Please excuse the obviousness of my question (if it is), but I have > searched the documentation for how to generate a list e.g. [(1,2), > (3,4)] from a string "[(1,2), (3,4)]". I wonder if someone could point > me in the right direction

[Tutor] string to list

2010-02-10 Thread Owain Clarke
Please excuse the obviousness of my question (if it is), but I have searched the documentation for how to generate a list e.g. [(1,2), (3,4)] from a string "[(1,2), (3,4)]". I wonder if someone could point me in the right direction. Many thanks Owain Clarke __

[Tutor] "Error :Attempt to overwrite cell" while using xlwt to create excel sheets

2010-02-10 Thread nikunj badjatya
Hi, I am using xlwt 0.7.2 and Python 2.6. I come across a situation wherein one of the "rows" of the excel sheet created was being overwritten. And it was flagging the following error. File "/usr/local/lib/python2.6/site-packages/xlwt/Row.py", line 150, in insert_cell raise Exception(msg) Exc

Re: [Tutor] how to clear contents of a file

2010-02-10 Thread Alan Gauld
"sudhir prasad" wrote how to clear contents of a file with out actually deleting it, reopening it for write will, clear the contents. However basically wat im trying to do is copy a source file into a common file ,run the common file,after that i need to copy another source file in