Re: [Tutor] Hello World in Python without space

2011-07-11 Thread Emile van Sebille
On 7/10/2011 4:12 AM Robert H said... Dear all, I have Python 3.2 installed on Windows 7. I am a complete beginner playing around with the basic functions. My problem is the following script: name="world" print("Hello", name,"!") print("Hello", name+"!") Alan mentioned using concatenation

[Tutor] List methods inside a dictionary of list

2011-07-11 Thread Rafael Turner
Hello, I am playing lists and dictionaries and I came across this counter-intuitive result. >>> d = dict(zip(['a', 'q', 'c', 'b', 'e', 'd', 'g', 'j'],8*[[0]])) >>>d Out: {'a': [0], 'b': [0], 'c': [0], 'd': [0], 'e': [0], 'g': [0], 'j': [0], 'q': [0]} >>> d['a'].__setitem__(0,4) >>> d Out:

Re: [Tutor] Tutor Digest, Vol 89, Issue 22

2011-07-11 Thread ctak...@gmail.com
It just name+"!", this is string concatenation tutor-requ...@python.org wrote: >Send Tutor mailing list submissions to > tutor@python.org > >To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/tutor >or, via email, send a message with su

Re: [Tutor] List methods inside a dictionary of list

2011-07-11 Thread Walter Prins
Hi, On 11 July 2011 14:26, Rafael Turner wrote: > > >>> d = dict(zip(['a', 'q', 'c', 'b', 'e', 'd', 'g', 'j'],8*[[0]])) > >>>d > Out: > {'a': [0], > 'b': [0], > 'c': [0], > 'd': [0], > 'e': [0], > 'g': [0], > 'j': [0], > 'q': [0]} > > >>> d['a'].__setitem__(0,4) > >>> d > Out: > {'a': [4]

Re: [Tutor] List methods inside a dictionary of list

2011-07-11 Thread Brett Ritter
On Mon, Jul 11, 2011 at 9:26 AM, Rafael Turner wrote: > I am playing lists and dictionaries and I came across this > counter-intuitive result. > d = dict(zip(['a', 'q', 'c', 'b', 'e', 'd', 'g', 'j'],8*[[0]])) ... d['a'].__setitem__(0,4) ... > > I was not expecting all the keys to be upda

Re: [Tutor] List methods inside a dictionary of list

2011-07-11 Thread Rafael Turner
I did not understand the behavior of array multiplication. In fact, I just now learned what it was called thanks to your email. Best wishes, Rafael On Mon, Jul 11, 2011 at 9:33 AM, Brett Ritter wrote: > On Mon, Jul 11, 2011 at 9:26 AM, Rafael Turner > wrote: >> I am playing lists and dictionari

[Tutor] compare and arrange file

2011-07-11 Thread Edgar Almonte
hello , i have a file this a structure like this X | 0.00| 88115.39| X | 90453.29| 0.00| X | 0.00| 90443.29| X | 88115.39| 0.00| X | 0.00|

Re: [Tutor] compare and arrange file

2011-07-11 Thread Emile van Sebille
On 7/11/2011 3:16 PM Edgar Almonte said... hello , i have a file this a structure like this X | 0.00| 88115.39| X | 90453.29| 0.00| X | 0.00| 90443.29| X | 88115.39| 0.0

Re: [Tutor] compare and arrange file

2011-07-11 Thread Dave Angel
On 07/11/2011 06:39 PM, Emile van Sebille wrote: On 7/11/2011 3:16 PM Edgar Almonte said... hello , i have a file this a structure like this X | 0.00| 88115.39| X | 90453.29| 0.00| X | 0.00| 90443.29|

Re: [Tutor] compare and arrange file

2011-07-11 Thread Edgar Almonte
Thanks for the hints , what i want accomplish is sort the line by the same value in the column 2 and 3 i mean the line with the same value in the 2 get together with the line in the same value in column 3 emile and david thanks again let me check the hint that your give me, i will feedback the co

Re: [Tutor] compare and arrange file

2011-07-11 Thread Edgar Almonte
back again, yes that is the idea: "> If I venture a guess, it seems to me that you want the debits and > corresponding offsetting credits listed in sequence." but not sure if i get you pseudo code , you mean some how flag the line when is D or C ( credit of debit ) and then sort by what ? On Mon

Re: [Tutor] compare and arrange file

2011-07-11 Thread Edgar Almonte
back again david i do the for because the line is delimited by pipeline so and i need get the field number 2 and 3 of the line if i understand well the split('|')[z] will just split till there ( z value ) so if i do split('|')[2] i will get: X , 0.00 and i just want the num

Re: [Tutor] compare and arrange file

2011-07-11 Thread Steve Willoughby
On 11-Jul-11 16:50, Edgar Almonte wrote: Thanks for the hints , what i want accomplish is sort the line by the same value in the column 2 and 3 i mean the line with the same value in the 2 get together with the line in the same value in column 3 What if the same value appears more than once?

Re: [Tutor] compare and arrange file

2011-07-11 Thread Edgar Almonte
this is just one time thing and the value don't get repeat On Mon, Jul 11, 2011 at 7:55 PM, Steve Willoughby wrote: > On 11-Jul-11 16:50, Edgar Almonte wrote: >> >> Thanks for the hints , what i want accomplish is sort the line by the >> same value in the column 2 and 3 >> >> i mean the line with

Re: [Tutor] compare and arrange file

2011-07-11 Thread Steve Willoughby
On 11-Jul-11 17:18, Edgar Almonte wrote: this is just one time thing and the value don't get repeat Then you could make a single loop over the input lines, building two dictionaries as you go: * one that maps column 2's value to the rest of that line's data * and one that does this for colu

Re: [Tutor] compare and arrange file

2011-07-11 Thread Edgar Almonte
i not too smart steve , can you show me with code ? On Mon, Jul 11, 2011 at 8:22 PM, Steve Willoughby wrote: > On 11-Jul-11 17:18, Edgar Almonte wrote: >> >> this is just one time thing and the value don't get repeat > > Then you could make a single loop over the input lines, building two > dicti

Re: [Tutor] compare and arrange file

2011-07-11 Thread Emile van Sebille
On 7/11/2011 5:02 PM Edgar Almonte said... back again, yes that is the idea: "> If I venture a guess, it seems to me that you want the debits and corresponding offsetting credits listed in sequence." but not sure if i get you pseudo code , you mean some how flag the line when is D or C ( cre

Re: [Tutor] compare and arrange file

2011-07-11 Thread Edgar Almonte
thanks emile i understand exactly what you explain me but i was unable to accomplish it ( too noob in python ) but i solved the problem with this code http://pastebin.com/4A6Jz4wZ i will try do what you suggest me anyway but that will tomorrow , tonight i done and i feel good :D Thanks all for th