Re: [Tutor] Python 2.7.1 interpreter question

2010-12-29 Thread Steven D'Aprano
Frank Chang wrote: When I use the Python 2.7.1 interpreter I get the following traceback : F:\shedskin\shedskin-0.7>python automata_test2.py Traceback (most recent call last): File "automata_test2.py", line 23, in list(automata.find_all_matches('nice', 1, m)) AttributeError: 'modul

Re: [Tutor] Python 2.7.1 interpreter question

2010-12-29 Thread Alan Gauld
"Frank Chang" wrote automata.py. The pastebin url for automata.py is: http://pastebin.com/embed_iframe.php?i=J9MRPibX"; style="border:none;width:100%"> list(automata.find_all_matches('nice', 1, m)) AttributeError: 'module' object has no attribute 'find_all_matches' find_all_matches() i

[Tutor] Python 2.7.1 interpreter question

2010-12-29 Thread Frank Chang
I separated my test program into two python files. The first one is automata.py. The pastebin url for automata.py is: http://pastebin.com/embed_iframe.php?i=J9MRPibX"; style="border:none;width:100%"> The second file is automata_test2.py. It imports automata.py. The pastebin url for automat

Re: [Tutor] Print Help

2010-12-29 Thread Dave Angel
On 01/-10/-28163 02:59 PM, delegb...@dudupay.com wrote: #§¶Ú%¢Šh½êÚ–+-jwm…éé®)í¢ëZ¢w¬µ«^™éí¶­qªë‰ë–[az+^šÈ§¶¥ŠË^×Ÿrœ’)à­ë)¢{°*'½êí²ËkŠx,¶­–Š$–)`·...@Ý"žÚ Not sure why the quoting of this particular message didn't work. Since I have no problem with anyone else's message, I suggest i

Re: [Tutor] scraping and saving in file SOLVED

2010-12-29 Thread Stefan Behnel
Peter Otten, 29.12.2010 13:45: File "/usr/lib/pymodules/python2.6/BeautifulSoup.py", line 430, in encode return self.decode().encode(encoding) Wow, that's evil. Stefan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscrip

[Tutor] Print Help

2010-12-29 Thread delegbede
I want to loop over a list and then print out a one statement that carries all the items in the list e.g def checking(responses): ''' Converts strings that look like A2C3D89AA90 into {'A':'2', 'C':'3', 'D':'89', 'AA':'90'}''' responses=dict(re.findall(r'([A-Z]{1,2})(

Re: [Tutor] scraping and saving in file SOLVED

2010-12-29 Thread Peter Otten
Tommy Kaas wrote: > With Stevens help about writing and Peters help about import codecs - and > when I used \r\n instead of \r to give me new lines everything worked. I > just thought that \n would be necessary? Thanks. > Tommy Newline handling varies across operating systems. If you are on Windo

[Tutor] python telnet slow down.

2010-12-29 Thread Rayon
Hi I need help with a some telnet automation I am trying build. I need to login to a Nortel switch and send a table dump command capture that data and send it to I file. I have the code it, works and does all that I need my problem is that when I try to dump a table later than 4 mega the it can t

Re: [Tutor] scraping and saving in file

2010-12-29 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Tommy Kaas wrote: Steven D'Aprano wrote: But in your case, the best way is not to use print at all. You are writing to a file -- write to the file directly, don't mess about with print. Untested: f = open('tabeltest.txt', 'w') url = 'http://www.kaasogmulvad.dk/unv/

[Tutor] scraping and saving in file SOLVED

2010-12-29 Thread Tommy Kaas
With Stevens help about writing and Peters help about import codecs - and when I used \r\n instead of \r to give me new lines everything worked. I just thought that \n would be necessary? Thanks. Tommy > -Oprindelig meddelelse- > Fra: tutor-bounces+tommy.kaas=kaasogmulvad...@python.org >

Re: [Tutor] scraping and saving in file

2010-12-29 Thread Peter Otten
Tommy Kaas wrote: > Steven D'Aprano wrote: >> But in your case, the best way is not to use print at all. You are >> writing > to a >> file -- write to the file directly, don't mess about with print. >> Untested: >> >> >> f = open('tabeltest.txt', 'w') >> url = 'http://www.kaasogmulvad.dk/unv/pyt

Re: [Tutor] scraping and saving in file

2010-12-29 Thread Tommy Kaas
Steven D'Aprano wrote: > But in your case, the best way is not to use print at all. You are writing to a > file -- write to the file directly, don't mess about with print. Untested: > > > f = open('tabeltest.txt', 'w') > url = 'http://www.kaasogmulvad.dk/unv/python/tabeltest.htm' > soup = Beautif

Re: [Tutor] scraping and saving in file

2010-12-29 Thread Peter Otten
Tommy Kaas wrote: > I’m trying to learn basic web scraping and starting from scratch. I’m > using Activepython 2.6.6 > I have uploaded a simple table on my web page and try to scrape it and > will save the result in a text file. I will separate the columns in the > file with > #. > It works fin

Re: [Tutor] scraping and saving in file

2010-12-29 Thread Knacktus
Am 29.12.2010 10:54, schrieb Tommy Kaas: Hi, I’m trying to learn basic web scraping and starting from scratch. I’m using Activepython 2.6.6 I have uploaded a simple table on my web page and try to scrape it and will save the result in a text file. I will separate the columns in the file with #.

Re: [Tutor] scraping and saving in file

2010-12-29 Thread Steven D'Aprano
Tommy Kaas wrote: I have uploaded a simple table on my web page and try to scrape it and will save the result in a text file. I will separate the columns in the file with #. It works fine but besides # I also get spaces between the columns in the text file. How do I avoid that? The print comm

Re: [Tutor] Python 2.7.1 interpreter passing function pointer as function argument and Shedskin 0.7

2010-12-29 Thread Steven D'Aprano
Alan Gauld wrote: "Frank Chang" wrote I apologize for the cut and paste mangling. Is there a better method than copy-pasting for including 20 or more lines of python source code in the tutor posts? Thank you. Long listings are usually better in pastebin - where the indentation is clear

[Tutor] scraping and saving in file

2010-12-29 Thread Tommy Kaas
Hi, I’m trying to learn basic web scraping and starting from scratch. I’m using Activepython 2.6.6 I have uploaded a simple table on my web page and try to scrape it and will save the result in a text file. I will separate the columns in the file with #. It works fine but besides # I also get

Re: [Tutor] Python 2.7.1 interpreter passing function pointer as function argument and Shedskin 0.7

2010-12-29 Thread Alan Gauld
"Frank Chang" wrote I apologize for the cut and paste mangling. Is there a better method than copy-pasting for including 20 or more lines of python source code in the tutor posts? Thank you. Long listings are usually better in pastebin - where the indentation is clear and we get synta

Re: [Tutor] Python 2.7.1 interpreter passing function pointer as function argument and Shedskin 0.7

2010-12-29 Thread Frank Chang
I asked the Shedskin developers about this issue and they are currently adding support for __call__ . They recommend renaming the class Matcher __call__ method ,for example as next, and then explicitly call it on line 148 as lookup_func.next(match). I followed their suggestion and the Sh