Re: [Tutor] Decimals 'not equal to themselves' (e.g. 0.2 equals 0.200000001)

2008-08-05 Thread Terry Carroll
On Sun, 3 Aug 2008, CNiall wrote: > >>> 0.2 > 0.20001 > >>> 0.33 > 0.33002 > > As you can see, the last two decimals are very slightly inaccurate. > However, it appears that when n in 1/n is a power of two, the decimal > does not get 'thrown off'. How might I make Pyth

[Tutor] Ongoing trouble with Turtle's end_fill()

2008-08-05 Thread Dick Moores
For a while now I've had trouble with end_fill(). Sometimes I can use it to fill a figure such as a square, triangle or rectangle, but sometimes not. Here's a barebones script using end_fill(). As you can see, it draws a square twice, but fails to fill it. Pleas show me how to use it correctly in

Re: [Tutor] iterating data and populating a dictionary

2008-08-05 Thread Alan Gauld
"Alan Gauld" <[EMAIL PROTECTED]> wrote index = float(the_line[-1]) dif_index = index - start_index iindex[field] = dif_index Here index is assigned to a floating point number. Then it is indexed. Floats don't have indexes... Just noticed the indexed vari

Re: [Tutor] iterating data and populating a dictionary

2008-08-05 Thread Alan Gauld
"Bryan Fodness" <[EMAIL PROTECTED]> wrote i am filling a dictionary with a dictionary and my values for isegment[field] are identical. i can't see where i am overwriting the previous field values. Show us the full error text do not just summarize. i would like to have something like, {1:

Re: [Tutor] Firstrade Authentication: Form Management

2008-08-05 Thread Federo
I have tried but I recived error. Look attached files: FormManagementCode (my code) and FormManagement_Note (headers information). There must be some additional trick to fully master form management .. Fake account is now active. URL: https://investor.firstrade.com/firstrade/login.do On screen:

Re: [Tutor] iterating data and populating a dictionary

2008-08-05 Thread Monika Jisswel
oops i forgot to count lines, MainDictionary = {} N = 0 M = 0 for line in open('data_file', 'r'): if line: if M < 3: N += 1 M += 1 a, b = line.split(" = ") # "=" is in between spaces whish gives you only two variables. if a == 'Field':

Re: [Tutor] iterating data and populating a dictionary

2008-08-05 Thread Monika Jisswel
maybe this can help MainDictionary = {} N = 0 for line in open('data_file', 'r'): if line: N += 1 a, b = line.split(" = ") # "=" is in between spaces whish gives you only two variables. if a == 'Field': MainDictionary[N] == {} elif a == 'Index':

[Tutor] iterating data and populating a dictionary

2008-08-05 Thread Bryan Fodness
i am filling a dictionary with a dictionary and my values for isegment[field] are identical. i can't see where i am overwriting the previous field values. my data looks like Field = aa1 Index = 0.0 Value = 0.0 ... ... Field = aa2 Index = 0.01 Value = 0.5 ... i would like to have something lik

Re: [Tutor] regular expressions

2008-08-05 Thread Kent Johnson
On Tue, Aug 5, 2008 at 7:01 AM, Jim Morcombe <[EMAIL PROTECTED]> wrote: > Could someone please give me some help using the "re" module. > If I have: > text = "Bill Smith is nice" > how do I get rid of "Smith" and just have > "Bill is nice" > > I tried > s2 = re.sub('Smith', '', text) > but it comp

Re: [Tutor] regular expressions

2008-08-05 Thread Monika Jisswel
here is what my interpreter gives : >>> >>> >>> text = "Bill Smith is nice" >>> print text Bill Smith is nice >>> re.sub('Smith', '', text) 'Bill is nice' >>> text = "Jim likes a girl (Susan)" >>> print text Jim likes a girl (Susan) >>> KeyboardInterrupt >>> re.sub('(Susan)', '', text) 'Jim likes

Re: [Tutor] regular expressions

2008-08-05 Thread arsyed
On Tue, Aug 5, 2008 at 7:01 AM, Jim Morcombe <[EMAIL PROTECTED]> wrote: > Could someone please give me some help using the "re" module. > > This works: > > import re > > text = "Jim is a good guy" > > s2 = re.sub('Jim', 'Fred', text) > print s2 > > and I get "Fred i

[Tutor] regular expressions

2008-08-05 Thread Jim Morcombe
Could someone please give me some help using the "re" module. This works: import re text = "Jim is a good guy" s2 = re.sub('Jim', 'Fred', text) print s2 and I get "Fred is a good guy" - If I have: text = "Bill Smith is nice" how

Re: [Tutor] removing whole numbers from text

2008-08-05 Thread Monika Jisswel
[EMAIL PROTECTED] ~]# python Python 2.5.1 (r251:54863, Nov 23 2007, 16:16:53) [GCC 4.1.1 20070105 (Red Hat 4.1.1-51)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> >>> import re >>> >>> a = 'this is a simple 3xampl3 of 2 or 3 numb3rs' # some text >>> b = re.su

Re: [Tutor] removing whole numbers from text

2008-08-05 Thread Ricardo Aráoz
Dinesh B Vadhia wrote: I want to remove whole numbers from text but retain numbers attached to words. All whole numbers to be removed have a leading and trailing space. For example, in "the cow jumped-20 feet high30er than the lazy 20 timing fox who couldn't keep up the 865 meter race." remov

Re: [Tutor] My experience on web.py

2008-08-05 Thread nkv
[..] > share > their thoughts on these > matters,  I've been using TurboGears for a long time now. The documentation is a little patchy (reads more like a bunch of recipes) but the components which form the framework are all separate projects - each individually capable of standing on it's own le

Re: [Tutor] Any Italian speakers?

2008-08-05 Thread simone
Alan Gauld ha scritto: --- voglio chiderti solo 1 cosa ... ma secondo te qualle e il miglior programma X programmare??? grazie ... da Cristian - Literally: --- "I want to ask you only one thing... what's in your opinion the best program to p