Re: [Tutor] comparing strings

2011-02-24 Thread Edward Martinez
On 02/24/11 02:56, Dave Angel wrote: On 01/-10/-28163 02:59 PM, Edward Martinez wrote: On 02/23/11 19:29, Corey Richardson wrote: On 02/23/2011 10:22 PM, Edward Martinez wrote: Hi, I'm new to the list and programming. i have a question, why when i evaluate strings ie 'a'> '3' it reports true,

Re: [Tutor] list of dictionary

2011-02-24 Thread Pacific Morrowind
Hi; On 24/02/2011 9:35 PM, sunil tech wrote: Hi all... i have d=[{'qty':0.0},{'qty':0.0}] If there isn't some pressing reason to dictionaries as the list items (but since I'm not sure how you're generating the list/what you are later using the list I can't tell ofc but if applicable to your

[Tutor] list of dictionary

2011-02-24 Thread sunil tech
Hi all... i have d=[{'qty':0.0},{'qty':0.0}] when all the qty is 0.0, i want to perform some print operation (only at once, after it checks everything in the list of dictionary 'd')... if its not 0.0, print some message... Thank you in advance ___ Tut

Re: [Tutor] Display all field of a listuples

2011-02-24 Thread bob gailer
On 2/24/2011 4:54 PM, Christopher Brookes wrote: Hi i would like to display all the field of my powerAll like this : Choose a power : Froid devorant : Embrase lenemi et le feu bruler Flammes infernales : 'Gele lenemi sur place - class Character(): def ChoosePouvo

Re: [Tutor] accessing another system's environment

2011-02-24 Thread Steve Willoughby
On 24-Feb-11 19:30, Bill Allen wrote: I have times when it is useful for me to check the environment of a user system on our lan remotely while trouble shooting and issue with them. Now, this is quite easy to do while I am using a windows system via the Are you sure you're talking about the sa

Re: [Tutor] accessing another system's environment

2011-02-24 Thread Bill Allen
I have times when it is useful for me to check the environment of a user system on our lan remotely while trouble shooting and issue with them. Now, this is quite easy to do while I am using a windows system via the computer management console. However, I am trying to do this via a linux worksta

Re: [Tutor] Display all field of a listuples

2011-02-24 Thread Steven D'Aprano
Christopher Brookes wrote: class Power: def __init__(self, name, desc): self.name = name self.desc = desc powerAll = [ Power('Flammes infernales' , 'Embrase lenemi et le feu bruler'), Power('Froid devorant', 'Gele lenemi sur place')] im *WANT to display this* : Froid d

Re: [Tutor] Display all field of a listuples

2011-02-24 Thread Alan Gauld
"Christopher Brookes" wrote class Character: def __init__(self, name): self.name = name def ChoosePouvoirUnique(self): """ Permet de choisir le pouvoir unique du personnage """ print ("Veuillez choisir votre pouvoir unique dans la liste") for PowerNom,Power

Re: [Tutor] Help on Python Looping Please

2011-02-24 Thread Dave Angel
On 02/24/2011 11:55 AM, Walter Prins wrote: On 24 February 2011 16:22, Dave Angel wrote: (Is there a reason you double-spaced all that code? It makes it very hard to read, and quite difficult to quote, since I had to delete every other line.) For what it's worth the code came out perfectl

Re: [Tutor] Display all field of a listuples

2011-02-24 Thread Alex Hall
On 2/24/11, Christopher Brookes wrote: > class Character: >def __init__(self, name): > self.name = name > > def ChoosePouvoirUnique(self): > """ Permet de choisir le pouvoir unique du personnage """ > print ("Veuillez choisir votre pouvoir unique dans la liste")

Re: [Tutor] Display all field of a listuples

2011-02-24 Thread Alex Hall
On 2/24/11, Christopher Brookes wrote: > class Character: >def __init__(self, name): > self.name = name > > def ChoosePouvoirUnique(self): > """ Permet de choisir le pouvoir unique du personnage """ > print ("Veuillez choisir votre pouvoir unique dans la liste")

Re: [Tutor] having difficulty installing python

2011-02-24 Thread Mark Weil
Is there a reason you don't want to use the newer, already pre-installed version? http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/python.1.html ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscrip

Re: [Tutor] Display all field of a listuples

2011-02-24 Thread Christopher Brookes
class Character: def __init__(self, name): self.name = name def ChoosePouvoirUnique(self): """ Permet de choisir le pouvoir unique du personnage """ print ("Veuillez choisir votre pouvoir unique dans la liste") for PowerNom,PowerDesc in powerAll:

Re: [Tutor] Display all field of a listuples

2011-02-24 Thread Steven D'Aprano
Alex Hall wrote: On 2/24/11, Christopher Brookes wrote: Hi i would like to display all the field of my powerAll like this : Choose a power : Froid devorant : Embrase lenemi et le feu bruler Flammes infernales : 'Gele lenemi sur place - class Character(): def Ch

Re: [Tutor] having difficulty installing python

2011-02-24 Thread Steven D'Aprano
Neven Dragojlovic wrote: Please can someone help me? I am trying to install python 2.5.4 on MacBookPro running on OS10.6.6, This is a mailing list for beginners to programming Python, not a general Python mailing list. It's quite likely that nobody here knows enough about installing softwar

Re: [Tutor] Display all field of a listuples

2011-02-24 Thread Alex Hall
On 2/24/11, Christopher Brookes wrote: > Hi i would like to display all the field of my powerAll like this : > > Choose a power : > Froid devorant : Embrase lenemi et le feu bruler > Flammes infernales : 'Gele lenemi sur place > > - > class Character(): > def Choose

Re: [Tutor] Dictionnaries in object

2011-02-24 Thread bob gailer
Always reply-all so a copy goes to the list. On 2/24/2011 2:20 PM, Christopher Brookes wrote: Oh yes, did'nt think about it. I love this solution Ty :) ! BTW i add Character class, how can i add to it ONE power ? Sorry I don't understand. class Character(): """ Classe du personnage, ses

[Tutor] Display all field of a listuples

2011-02-24 Thread Christopher Brookes
Hi i would like to display all the field of my powerAll like this : Choose a power : Froid devorant : Embrase lenemi et le feu bruler Flammes infernales : 'Gele lenemi sur place - class Character(): def ChoosePouvoirUnique(self): print ("Choose a power")

Re: [Tutor] Dictionnaries in object

2011-02-24 Thread bob gailer
On 2/24/2011 1:58 PM, Christopher Brookes wrote: Hi, I want to create some powers in my fight program. I want to know if dictionnaries is the best solution to do it. For now its look like this : //French name and description, don't care about it ;) power1= {} power1['Name'] = 'Flammes infern

Re: [Tutor] Dictionnaries in object

2011-02-24 Thread Corey Richardson
On 02/24/2011 01:58 PM, Christopher Brookes wrote: > Hi, > > I want to create some powers in my fight program. > I want to know if dictionnaries is the best solution to do it. > > For now its look like this : > > > //French name and description, don't care about it ;) > > power1= {} > power1['

[Tutor] Dictionnaries in object

2011-02-24 Thread Christopher Brookes
Hi, I want to create some powers in my fight program. I want to know if dictionnaries is the best solution to do it. For now its look like this : //French name and description, don't care about it ;) power1= {} power1['Name'] = 'Flammes infernales' power1['Description'] = 'Embrase lenemi et le

Re: [Tutor] Help on Python Looping Please

2011-02-24 Thread Walter Prins
On 24 February 2011 16:22, Dave Angel wrote: > > (Is there a reason you double-spaced all that code? It makes it very hard > to read, and quite difficult to quote, since I had to delete every other > line.) > For what it's worth the code came out perfectly fine on my email reader (GMail). (No d

Re: [Tutor] relative imports

2011-02-24 Thread Alex Hall
Sorry, I forgot to say that the error is: ValueError: attempted relative import in non-package. On 2/24/11, Alex Hall wrote: > Hi all, > I am trying to place some common files into a folder so that all files > in other folders can access the common files. That is, the file for a > card class, a d

Re: [Tutor] Python object

2011-02-24 Thread Steve Willoughby
On 24-Feb-11 08:13, James Reynolds wrote: I don't understand what you are trying to do? I'm assuming def GetAllAtrib is a method within a class; perhaps you could copy more the code base? It seems to be locating the three elements you have in that method just fine, but I'm guessing you have ano

Re: [Tutor] merging 2 files.

2011-02-24 Thread nitin chandra
On Thu, Feb 24, 2011 at 9:18 PM, nitin chandra wrote: > Hi Martin, > > Thanks a lot. It did work, but I am trying to break it down and  understand > >>  import csv >> >>  # -- build the lookup table >>  # >>  lookup = dict() >>  file0 = csv.reader(open('jhun.csv','r')) >>  for row in file0: >>    

[Tutor] having difficulty installing python

2011-02-24 Thread Neven Dragojlovic
Please can someone help me? I am trying to install python 2.5.4 on MacBookPro running on OS10.6.6, but when I try to set it up on Terminal by running "python setup.py install" I get the following: IDLE Subprocess: Connection to IDLE GUI failed, exiting. Tk_MacOSXSetupTkNotifier: first [load] of TkA

Re: [Tutor] Help on Python Looping Please

2011-02-24 Thread pyhx0r
Dear All, Thank you for your advise, it's helpful for me. NB: To DaveA, It was copy-paste from my notepad so the indentation went wrong :( +---+--+---+ | py | h | x0r | +---+--+---+ ■ 1 3 0 E2 C 9 ■ ___ Tutor maillist - Tutor@python.org To u

Re: [Tutor] Python object

2011-02-24 Thread Peter Otten
Christopher Brookes wrote: > Hi, i'm new in python. > I'm trying to create a small fight program in object. > > I've created __init__ (its works) but when i'm trying to display init > param i'm getting param and "None" every time. Why ? > > def GetAllAtrib(self): > print '---

Re: [Tutor] Help on Python Looping Please

2011-02-24 Thread Dave Angel
On 01/-10/-28163 02:59 PM, pyhx0r wrote: Dear All, multiple = 1024 if a_kilobyte_is_1024_bytes else 1000 for suffix in SUFFIXES[multiple]: size /= multiple if size< multiple: return '{0:.1f} {1}'.format(size, suffix) I’ve shorted the code be:

Re: [Tutor] Python object

2011-02-24 Thread James Reynolds
I don't understand what you are trying to do? I'm assuming def GetAllAtrib is a method within a class; perhaps you could copy more the code base? It seems to be locating the three elements you have in that method just fine, but I'm guessing you have another print statement somewhere that is causi

[Tutor] Python object

2011-02-24 Thread Christopher Brookes
Hi, i'm new in python. I'm trying to create a small fight program in object. I've created __init__ (its works) but when i'm trying to display init param i'm getting param and "None" every time. Why ? def GetAllAtrib(self): print '---' pr

Re: [Tutor] Help on Python Looping Please

2011-02-24 Thread Walter Prins
On 24 February 2011 14:52, pyhx0r wrote: > *Why do in my code, it loops to all values and not in Mark Pilgrim’s code? > * > > Because in Mark's code the loop is terminated by the return statement (contained in the utility function approximate_size().) In your code you've removed the entire funct

[Tutor] Help on Python Looping Please

2011-02-24 Thread pyhx0r
Dear All, I’m new in programming and I’m studying Python now. I use Python 3.1.2 and learn from Dive Into Python 3 book (Mark Pilgrim, Thank you very much for him). I’ve learned list, tuple, set, dictionary and little bit about looping. I’m so confused about looping in first Python Program in tha

Re: [Tutor] Convert string to long

2011-02-24 Thread Joel Goldstick
On Thu, Feb 24, 2011 at 9:03 AM, tee chwee liong wrote: > >>> '0x' + hex(543)[2:].zfill(5) > '0x0021f' > > this is a good way but it's still in string format. but if i convert it to > long, then the leading 0s will be truncated. i guess can't have it both way. > > > > > > > > > > ___

Re: [Tutor] Convert string to long

2011-02-24 Thread Andre Engels
On Thu, Feb 24, 2011 at 3:03 PM, tee chwee liong wrote: '0x' + hex(543)[2:].zfill(5) > '0x0021f' > > this is a good way but it's still in string format. but if i convert it to > long, then the leading 0s will be truncated. i guess can't have it both way. A long is just a number. You cannot s

Re: [Tutor] Convert string to long

2011-02-24 Thread tee chwee liong
>>> '0x' + hex(543)[2:].zfill(5) '0x0021f' this is a good way but it's still in string format. but if i convert it to long, then the leading 0s will be truncated. i guess can't have it both way. ___ Tutor maillist - Tutor@python.org To un

Re: [Tutor] Convert string to long

2011-02-24 Thread Joel Goldstick
On Thu, Feb 24, 2011 at 8:08 AM, Walter Prins wrote: > > > On 24 February 2011 11:50, tee chwee liong wrote: > >> > int(s,16) for a hex string >> > >> >> great but the leading zeroes are being truncated. >> > > You need to seperate the concept of display/formatting of some thing from > the actu

Re: [Tutor] help

2011-02-24 Thread bob gailer
Request: When posting a question use a meaningful subject line, as some of us track email by subject. -- Bob Gailer 919-636-4239 Chapel Hill NC ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python

Re: [Tutor] Convert string to long

2011-02-24 Thread Walter Prins
On 24 February 2011 11:50, tee chwee liong wrote: > > int(s,16) for a hex string > > > > great but the leading zeroes are being truncated. > You need to seperate the concept of display/formatting of some thing from the actual thing/value being displayed. Normally when we humans communicate num

Re: [Tutor] Clubbing simillar elements together in a list with repeating elements

2011-02-24 Thread Hugo Arts
Won't give you all the ansers, but here's a few tips. On Thu, Feb 24, 2011 at 12:29 PM, ranjan das wrote: > > I have a list > > a=[1,2,3,4,2,5,5,4,6,7,8] > > I want to club the repeating elements together and my output should be > something like > > a_new=[ [1], [2,2], [3], [4,4] , [5,5,5],[6], [

Re: [Tutor] Convert string to long

2011-02-24 Thread tee chwee liong
> int(s,16) for a hex string > great but the leading zeroes are being truncated. i want it to be: 0x00180400L >>> array0='00180400' >>> array1='' >>> array=array0+array1 >>> a=int(a

[Tutor] Clubbing simillar elements together in a list with repeating elements

2011-02-24 Thread ranjan das
I have a list a=[1,2,3,4,2,5,5,4,6,7,8] I want to club the repeating elements together and my output should be something like a_new=[ [1], [2,2], [3], [4,4] , [5,5,5],[6], [7], [8]] How do I do this? I tried the following but it is not giving me the desired result a=[1,2,3,2,3,4,5,4,5,5,6]

Re: [Tutor] Convert string to long

2011-02-24 Thread Steven D'Aprano
tee chwee liong wrote: hi, is there a way to convert from string to long? my_string = "1234" my_long = long(my_string) We're happy to help you, but you should make some effort to help yourself. Have you worked through the Python tutorial? Don't just *read* it, actually follow the instruct

Re: [Tutor] comparing strings

2011-02-24 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Edward Martinez wrote: On 02/23/11 19:29, Corey Richardson wrote: On 02/23/2011 10:22 PM, Edward Martinez wrote: Hi, I'm new to the list and programming. i have a question, why when i evaluate strings ie 'a'> '3' it reports true, how does python come up with that? W

Re: [Tutor] merging 2 files.

2011-02-24 Thread Martin A. Brown
Hi Nitin, : currently the data in both the file is 6 - 10,000 rows max. Many ways to skin this cat. You say that the files are 6-10,000 lines. These are small files. Load them into memory. Learn how to use csv.reader. : PROBLEM : I need to pick the "first coloum" from test.csv AND : S

Re: [Tutor] licensing python work?

2011-02-24 Thread Steven D'Aprano
Wayne Werner wrote: If you don't care how people use it at all, just release your code into the public domain, then it doesn't matter how they use it. That's actually not as easy as it sounds. It depends where you are. In some jurisdictions, such as the USA, it's hard to put work into the pub

[Tutor] merging 2 files.

2011-02-24 Thread nitin chandra
Hello Every One, I have A problem :) I have a file with data collected in with 5 colums in a CSV format. eg. test.csv (below) format --- 26290,75.318669993,28.390548328,"WELL 3","WELL 3 MENCHOKE FUNCTIOANL" 26290,75.316180604,28.3970

Re: [Tutor] help

2011-02-24 Thread Dipo Elegbede
i can mail free books on python 2. if you want. starting out with python 3.XXX restricts the amount of help you can get and also free resources. most resources i have come across are python 2.XXX. cheers. On Thu, Feb 24, 2011 at 9:58 AM, Andre Engels wrote: > On Thu, Feb 24, 2011 at 5:15 AM,

Re: [Tutor] help

2011-02-24 Thread Alan Gauld
"Chris Schiro" wrote I am completely new to programming aside from working with basic many years ago. I purchased a Python book for beginners so I could start from scratch which has been walking me through just fine until: writing a program to interact with user for feedback: name=input("Wh

Re: [Tutor] help

2011-02-24 Thread Dipo Elegbede
That line only expects int and say numbers generally. If you want to print strings, use, raw_input in place of input. Try that out and then let's have a feedback. Sent from my BlackBerry wireless device from MTN On Thu, Feb 24, 2011 at 9:53 AM, Nitin Pawar wrote: > instead of input ... use raw_in

Re: [Tutor] accessing another system's environment

2011-02-24 Thread Alan Gauld
"Bill Allen" wrote I know that I can use the following to get a listing of the environment of my own system. How can I do similar for another system on my network. This is for administrative purposes. Environments are user and process specific so you would need to access the remote machin

Re: [Tutor] help

2011-02-24 Thread عمـ نوفل ـاد
On 2/24/11, Chris Schiro wrote: > Hi, > > I am completely new to programming aside from working with basic many years > ago. I purchased a Python book for beginners so I could start from scratch > which has been walking me through just fine until: writing a program to > interact with user for feed

Re: [Tutor] help

2011-02-24 Thread Andre Engels
On Thu, Feb 24, 2011 at 5:15 AM, Chris Schiro wrote: > Hi, > > I am completely new to programming aside from working with basic many years > ago. I purchased a Python book for beginners so I could start from scratch > which has been walking me through just fine until: writing a program to > intera

Re: [Tutor] help

2011-02-24 Thread Noah Hall
> I have found that this line will return an error every time while running > the completed program, unless I enter a number. If I enter a numeric value > the program will continue on as written. When it comes to things like error messages, you need to post enough code and the _exact_ error messag

Re: [Tutor] help

2011-02-24 Thread Nitin Pawar
instead of input ... use raw_input() On Thu, Feb 24, 2011 at 9:45 AM, Chris Schiro wrote: > Hi, > > I am completely new to programming aside from working with basic many years > ago. I purchased a Python book for beginners so I could start from scratch > which has been walking me through just f

Re: [Tutor] Convert string to long

2011-02-24 Thread Alan Gauld
"tee chwee liong" wrote is there a way to convert from string to long? for eg: i want to concatenate all the arrays into data and make it same type (long) as data1. int() should work ok. Just remember to supply the base: eg. int(s,16) for a hex string HTH, Alan G. __

[Tutor] help

2011-02-24 Thread Chris Schiro
Hi, I am completely new to programming aside from working with basic many years ago. I purchased a Python book for beginners so I could start from scratch which has been walking me through just fine until: writing a program to interact with user for feedback: name=input("What is your name? ")