Re: [Tutor] Parsing Bible verses

2009-05-25 Thread John Fouhy
2009/5/26 Eduardo Vieira : > Now, a little farther on the topic of a Bible database. I'm not sure > how I should proceed. I don't really have the db file I need, I will > have to generate it somehow, from a bible software, because the > version I want is for Portuguese. I have found a bible in sql,

Re: [Tutor] Parsing Bible verses

2009-05-25 Thread Eduardo Vieira
On Sat, May 23, 2009 at 3:37 AM, C or L Smith wrote: > Here is something from my toolbox of routines that might be useful for the > number ranges: > indices('-5--2') > [-5, -4, -3, -2] indices('3-4') > [3, 4] indices('3-4,10') > [3, 4, 10] > > /chris > > def indices(s,n=None): #("1

Re: [Tutor] Find a good linux distribution with python.

2009-05-25 Thread Dave Crouse
It's not a newbie distro by any means, but i am very fond of Arch Linux. It has 3 versions of python available. Currently, python24 2.4.6-1 python 2.6.2-1 python3 3.0.1-1 are all very simple to install in Arch. I have 2.6 and 3.0 both installed. [cro...@veronica ~]$ python --version Python 2.6.2

Re: [Tutor] A few very basic questions

2009-05-25 Thread M Tramp
Alan Gauld: >>> Have you installed pygtk? You need both pygtk and gtk. The former uses the latter. Alan G <<< Yes. It is. I went back and installed more. Fink Commander lists 35 files with "gtk" -- five already were. (gtk+, gtk+-data, gtk+-shlibs, pygtk and pygtk-py23) I went back and found

[Tutor] Tinkering with Tkinter

2009-05-25 Thread Doug Reid
The following code and it's explanation doesn't seem to work:   1. >>> from Tkinter import * 2. >>> tk = Tk() 3. >>> btn = Button(tk, text="click me") 4. >>> btn.pack()   In line 1, we import the contents of the Tk module, so we can use them—the most useful of these is Tk, which creates a basic win

[Tutor] Can't print a string, gives me syntax error

2009-05-25 Thread phpfood
I ran this in IDLE: >>> t = 'hi' >>> print t SyntaxError: invalid syntax (, line 1) I've also tried this as sample.py : import string text = 'hello world' print text It gives me a syntax error on "print text" line What's going on? ___ Tutor maillist

Re: [Tutor] serious problem with graphics module

2009-05-25 Thread Gregor Lingl
roberto schrieb: hello everyone Hello Roberto, First question: Do you use Python from the command line (terminal) or do you use IDLE? I ask this, because these two show different behaviour. i have a problem with python 3.0 graphics module: no problem while importing the module impor

Re: [Tutor] serious problem with graphics module

2009-05-25 Thread Gregor Lingl
bob gailer schrieb: roberto wrote: hello everyone i have a problem with python 3.0 graphics module: no problem while importing the module import turtle but when i issue any command like: t = turtle.pen() t = turtle.forward(60) Your code fails for me at turtle.pen A

Re: [Tutor] serious problem with graphics module

2009-05-25 Thread Gregor Lingl
roberto schrieb: hello everyone i have a problem with python 3.0 graphics module: no problem while importing the module import turtle but when i issue any command like: t = turtle.pen() t = turtle.forward(60) nothing appears on the screen, only a blank window, wit

Re: [Tutor] Can't print a string, gives me syntax error

2009-05-25 Thread Alan Gauld
"xbmuncher" wrote I ran this in IDLE: t = 'hi' print t SyntaxError: invalid syntax (, line 1) I've also tried this as sample.py : import string text = 'hello world' print text It gives me a syntax error on "print text" line Looks like you are using Python v3. Most tutorials are stil

Re: [Tutor] A few very basic questions

2009-05-25 Thread Alan Gauld
"M Tramp" wrote the packages I needed. Fink appeared to be installing them fine with little interaction from me. I ran Eclipse again, but it still burps on: import gtk Have you installed pygtk? You need both pygtk and gtk. The former uses the latter. Alan G ___

Re: [Tutor] serious problem with graphics module

2009-05-25 Thread bob gailer
roberto wrote: hello everyone i have a problem with python 3.0 graphics module: no problem while importing the module import turtle but when i issue any command like: t = turtle.pen() t = turtle.forward(60) Your code fails for me at turtle.pen AttributeError: 'modul

Re: [Tutor] A few very basic questions

2009-05-25 Thread Walker Hale IV
On Sun, May 24, 2009 at 1:08 PM, M Tramp wrote: > > Hello all ... > > I've started trying ot learn about Python because I'm intrigued by what I've > read about Gramps, a genealogical data manager. To run Gramps on a Mac, I > need to get GTK up and running. Here's where I have a few, hopefully ba

Re: [Tutor] A few very basic questions

2009-05-25 Thread M Tramp
Alan Gauld btinternet.com> said: >>> Have you checked fink? There's a MacOS Gimp toolkit package available. (Well 3 actually, gtk, gtk-data and gtk-shlibs) I generally use fink rather than try apt-get because I know the fink stuff is tested against MacOS. And fink packages are pre-built usually.

Re: [Tutor] Can't print a string, gives me syntax error

2009-05-25 Thread Doug Reid
--- On Mon, 5/25/09, xbmuncher wrote: From: xbmuncher Subject: [Tutor] Can't print a string, gives me syntax error To: "tutor@python.org" Date: Monday, May 25, 2009, 5:48 PM I ran this in IDLE: >>> t = 'hi' >>> print t SyntaxError: invalid syntax (, line 1) I've also tried this as sample.

Re: [Tutor] Can't print a string, gives me syntax error

2009-05-25 Thread Sander Sweers
2009/5/25 xbmuncher : > I ran this in IDLE: t = 'hi' print t > SyntaxError: invalid syntax (, line 1) What version of python are you using (I suspect version 3)? > I've also tried this as sample.py : > import string > text = 'hello world' > print text If you are using python 3 then the

[Tutor] Can't print a string, gives me syntax error

2009-05-25 Thread xbmuncher
I ran this in IDLE: >>> t = 'hi' >>> print t SyntaxError: invalid syntax (, line 1) I've also tried this as sample.py : import string text = 'hello world' print text It gives me a syntax error on "print text" line What's going on? ___ Tutor maillist

Re: [Tutor] Search for hex data in file

2009-05-25 Thread Walker Hale IV
On Mon, May 25, 2009 at 1:32 AM, xbmuncher wrote: > I've been reading about ways to convert strings and what not to hex and back > and forth. I'm looking for the fastest and least memory intensive way to > search through a file for a hex value and gets its byte offset in the file. > This hex value

Re: [Tutor] Find a good linux distribution with python.

2009-05-25 Thread W W
On Mon, May 25, 2009 at 3:57 AM, Michael Bernhard Arp Sørensen < mich...@arpsorensen.dk> wrote: > > I just wished that Python was upgraded in the distros. If I want to play > with Python3, I will need to compile it my self and specify which Python > interpretor to use in each Python file. But thi

Re: [Tutor] IP-range

2009-05-25 Thread W W
On Sun, May 24, 2009 at 10:18 PM, Paras K. wrote: > Hello, > > I came across your answer / assistance on the IP range. I am fairly new to > the python world of programming. However, up to this point I have always > been able to get my programs to work by reading the books or following the > guide

Re: [Tutor] IP-range

2009-05-25 Thread Reed O'Brien
On May 24, 2009, at 11:18 PM, Paras K. wrote: Hello, I came across your answer / assistance on the IP range. I recommend looking at the ipaddr library: http://svn.python.org/projects/python/trunk/Lib/ipaddr.py There is some Sphinx documentation with the python 2.7 docs and some on the ori

Re: [Tutor] ?????

2009-05-25 Thread Dave Angel
prasad rao wrote: Hello It is printing wether the item is callable or not. I want it to print sys.getdefaultencoding ASCII sys.getfilesystemencoding mbcs Like that Prasad But when you get to sys.exit(), you'll be terminating your test. In general, it's not safe to just run through a lis

Re: [Tutor] ?????

2009-05-25 Thread A.T.Hofkamp
Alan Gauld wrote: Even if you use the other suggestions to prove its callable that doesn't mean you can do this: print sys.x() If the callable takes parameters then this will fail. You need to know quite a lot more about what you are calling and that is a non trivial task in the gener

Re: [Tutor] ?????

2009-05-25 Thread Alan Gauld
"prasad rao" wrote for x in dir(sys): ?? if sys.x is callable: Even if you use the other suggestions to prove its callable that doesn't mean you can do this: print sys.x() If the callable takes parameters then this will fail. You need to know quite a lot more about what you are

Re: [Tutor] ?????

2009-05-25 Thread Kent Johnson
On Mon, May 25, 2009 at 8:42 AM, Christian Witts wrote: > prasad rao wrote: >> >> hello >>      I get a problem while trying to print non callable >> items in dir(module).May be as the items are strings. >> >> for x in dir(sys): >> ?? if sys.x is callable: >>  print sys.x() >> ?? else:print s

Re: [Tutor] Search for hex data in file

2009-05-25 Thread Kent Johnson
On Mon, May 25, 2009 at 2:32 AM, xbmuncher wrote: > I've been reading about ways to convert strings and what not to hex and back > and forth. I'm looking for the fastest and least memory intensive way to > search through a file for a hex value and gets its byte offset in the file. > This hex value

[Tutor] IP-range

2009-05-25 Thread Paras K.
Hello, I came across your answer / assistance on the IP range. I am fairly new to the python world of programming. However, up to this point I have always been able to get my programs to work by reading the books or following the guides I find through google.com Here is what I have to do: I have

Re: [Tutor] ?????

2009-05-25 Thread Christian Witts
prasad rao wrote: >for attrib in dir(sys): > if callable('sys.%s' % attrib): >print 'Callable: sys.%s' % attrib > else: >print 'Not Callable: sys.%s' % attrib Any particular reason why you need to be able to do this, just wondering about the use case f

Re: [Tutor] ?????

2009-05-25 Thread prasad rao
>for attrib in dir(sys): > > if callable('sys.%s' % attrib): > >print 'Callable: sys.%s' % attrib > > else: > >print 'Not Callable: sys.%s' % attrib > > Any particular reason why you need to be able to do this, just wondering > about the use case for such automation ? > > -- > Kind R

Re: [Tutor] ?????

2009-05-25 Thread Christian Witts
prasad rao wrote: >Any particular reason why you need to be able to do this, just wondering about the use case for >such automation ? -- Kind Regards, Christian Witts Thank you Christian for the prompt repply. I am learning python. I am just examining what are all the a

Re: [Tutor] ?????

2009-05-25 Thread prasad rao
> > >Any particular reason why you need to be able to do this, just wondering > about the use case for >such automation ? > > -- > Kind Regards, > Christian Witts > > > Thank you Christian for the prompt repply. I am learning python. I am just examining what are all the available items in each modu

Re: [Tutor] ?????

2009-05-25 Thread A.T.Hofkamp
prasad rao wrote: hello I get a problem while trying to print non callable items in dir(module).May be as the items are strings. It is much easier to read about the contents of the sys module in the documentation: http://docs.python.org/library/sys.html#module-sys Not only is the conte

Re: [Tutor] ?????

2009-05-25 Thread Christian Witts
prasad rao wrote: hello I get a problem while trying to print non callable items in dir(module).May be as the items are strings. for x in dir(sys): ?? if sys.x is callable: print sys.x() ?? else:print sys.x Traceback (most recent call last): File "", line 2, in if sy

[Tutor] ?????

2009-05-25 Thread prasad rao
hello I get a problem while trying to print non callable items in dir(module).May be as the items are strings. for x in dir(sys): ?? if sys.x is callable: print sys.x() ?? else:print sys.x Traceback (most recent call last): File "", line 2, in if sys.x is callable: Attribut

Re: [Tutor] Find a good linux distribution with python.

2009-05-25 Thread Michael Bernhard Arp Sørensen
Hi Lloyd. I did not take offense about the comment on Ubuntu. It was an old joke and it made me smile again. :-) I've used Debian before, but I have moved to Ubuntu because Debian takes forever to release a new version. Almost as long as Microsoft. I like Debian based distro the most. To all

Re: [Tutor] Find a good linux distribution with python.

2009-05-25 Thread OkaMthembo
bhaaluu, your comments on Ubuntu are not only offensive, but display ignorance and arrogance all at the same time. Ubuntu is based on Debian, but provides a lower entry barrier to Linux for many. Not everybody wants to spend much time doing configurations. Many just want a system that works. Mich

Re: [Tutor] Search for hex data in file

2009-05-25 Thread Alan Gauld
"xbmuncher" wrote search through a file for a hex value and gets its byte offset in the file. This hex value (that I'm looking for in the file) is of course a hex representation of the binary data and its 8 bytes long. Can you give an example of your input data and what you expect the retur