Re: Least-lossy string.encode to us-ascii?

2012-09-13 Thread Mark Tolonen
On Thursday, September 13, 2012 4:53:13 PM UTC-7, Tim Chase wrote: > On 09/13/12 18:36, Terry Reedy wrote: > > > On 9/13/2012 5:26 PM, Tim Chase wrote: > > >> I've got a bunch of text in Portuguese and to transmit them, need to > > >> have them in us-ascii (7-bit). I'd like to keep as much info

Re: sys.stdout.detach() results in ValueError

2012-03-07 Thread Mark Tolonen
On Mar 7, 4:10 pm, Terry Reedy wrote: > On 3/7/2012 5:35 PM, Peter Kleiweg wrote: > > > > > > > > > > > Dave Angel schreef op de 7e dag van de lentemaand van het jaar 2012: > > >> On 03/07/2012 02:41 PM, Peter Kleiweg wrote: > >>> I want to write out some binary data to stdout in Python3. I > >>>

Re: the stupid encoding problem to stdout

2011-06-09 Thread Mark Tolonen
"Sérgio Monteiro Basto" wrote in message news:[email protected]... How I change sys.stdout.encoding always to UTF-8 ? at least have a consistent sys.stdout.encoding There is an environment variable that can force Python I/O to be a specfic encoding: PYTHONIOEN

Re: Mutability of function arguments?

2005-12-07 Thread Mark Tolonen
"ex_ottoyuhr" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm trying to create a function that can take arguments, say, foo and > bar, and modify the original copies of foo and bar as well as its local > versions -- the equivalent of C++ funct(&foo, &bar). > > I've looked around

Re: Embedding Python

2005-03-26 Thread Mark Tolonen
"Markus Franz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi! > > I wanted to run some Python code from inside a C program, so I did it > like it was explained in the Python manual: > > #include > int main(int argc, char *argv[]) { > Py_Initialize(); > PyRun_SimpleString("prin

Re: Embedding Python

2005-03-26 Thread Mark Tolonen
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> This works for me on Redhat 9: >> >> g++ x.cpp -o x -I/usr/include/python2.2 -pthread -lm >> -ldl -lutil /usr/lib/python2.2/config/libpython2.2.a >> > > Why did you chose the static variant? This should be equival

Re: Embedding Python

2005-03-26 Thread Mark Tolonen
"Reinhold Birkenfeld" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Heiko Wundram wrote: >> Am Samstag, 26. März 2005 20:43 schrieb Mark Tolonen: >>> On my system, for whatever reason, the .so library isn't present. I >>> have

Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-25 Thread Mark Tolonen
On Nov 25, 11:52 am, Sibylle Koczian wrote: > Am 25.11.2011 01:16, schrieb Steven D'Aprano: > > > As far as I can tell, nobody running the 64-bit version of Windows 7 has > > chimed in to either confirm or refute W. eWatson's claim that IDLE > > doesn't show up, so we have no way of telling whethe

Re: Any way to not create .pyc files?

2005-06-09 Thread Mark Tolonen
"Lonnie Princehouse" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In short: > > Is there any way to run Python WITHOUT trying to create .pyc files (or > .pyo) or to have Python not attempt to import the .pyc files it finds? > > Reason: > > We have a site-specific package installed

Re: Exceptions - How do you make it work like built-in exceptions?

2008-01-13 Thread Mark Tolonen
"Lie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >A built-in exceptions, when raised, would print traceback that points > out the offending code, like this: > > Traceback (most recent call last): > File "F:\dir\code.py", line 43, in >a = 1/0 <<<--- > ZeroDivisionError: inte

Re: handlers.SocketHandler and exceptions

2008-01-16 Thread Mark Tolonen
"writeson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > > On our Linux systems at work I've written a Twisted logging server > that receives log messages from multiple servers/processes to post > them to a log file, essentially serializing all the process log > messages

Re: regular expression negate a word (not character)

2008-01-25 Thread Mark Tolonen
"Summercool" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > somebody who is a regular expression guru... how do you negate a word > and grep for all words that is > > tire > > but not > > snow tire > > or > > snowtire > > so for example, it will grep for > > winter tire > ti

Re: Beginner String formatting question

2008-01-26 Thread Mark Tolonen
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > > I am trying to write a simple program that will accept an integral > "time" input in the HHMMSS format and output a "HH:MM:SS" form. My > code is as follows: > > import string > > def FormatTime(ti

Re: REALLY simple xml reader

2008-01-27 Thread Mark Tolonen
"Simon Pickles" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi > > Can anyone suggest a really simple XML reader for python? I just want to > be able to do something like this: > > xmlDoc = xml.open("file.xml") > element = xmlDoc.GetElement("foo/bar") > > ... to read the value

Re: Some questions about decode/encode

2008-01-27 Thread Mark Tolonen
>"John Machin" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >On Jan 27, 9:17 pm, glacier <[EMAIL PROTECTED]> wrote: >> On 1月24日, 下午3时29分, "Gabriel Genellina" <[EMAIL PROTECTED]> >> wrote: > >*IF* the file is well-formed GBK, then the codec will not mess up when >decoding it to Un

Re: strftime return value encoding (mbcs, locale, etc.)

2008-01-27 Thread Mark Tolonen
"Giovanni Bajo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I am trying to find a good way to portably get the output of strftime() > and put it onto a dialog (I'm using PyQt, but it doesn't really matter). > The problem is that I need to decode the byte stream return

Re: small problem with re.sub

2008-01-30 Thread Mark Tolonen
"Astan Chee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > I have a html text stored as a string. Now I want to go through this > string and find all 6 digit numbers and make links from them. > Im using re.sub and for some reason its not picking up the previously > matched

Re: brain stuck. whats occurring here?

2008-02-07 Thread Mark Tolonen
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hallo, > > I'm after > > [[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]]] > How about: >>> [[[]]*5]*5 [[[], [], [], [], []], [[], [], [], [], []], [[], [], [], [], []], [[], [], [], [], []], [[]

Re: Chinese character error

2008-02-08 Thread Mark Tolonen
"Chris" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Feb 8, 11:29 am, John Deas <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I made a small script to recursively copy files from a directory tree >> to an exportDir only if they have an mp3 extension : >> >> a=os.walk(os.getcwd()) >>

Re: Command line arguments in Windows

2008-03-03 Thread Mark Tolonen
"Mike Walker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >> If you run a python file, ie. just double clicking it the only >> argument you will have will be the filename of the script. If you >> create a shortcut to the script and in the target box add your >> arguments (if yo

Re: help needed with regex and unicode

2008-03-03 Thread Mark Tolonen
"Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Tue, 04 Mar 2008 10:49:54 +0530, Pradnyesh Sawant wrote: > >> I have a file which contains chinese characters. I just want to find out >> all the places that these chinese characters occur. >> >> The follo

Re: struct unpack

2008-03-17 Thread Mark Tolonen
"brnstrmrs" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If I run: > > testValue = '\x02\x00' > junk = struct.unpack('h', testValue) > > Everything works but If I run > > testValue = raw_input("Enter Binary Code..:") inputting at the > console '\x02\x00' > junk = struct.unpack('

Re: Is negative seek() from EOF of a GzipFile supported on Python 2.5.2 ?

2009-01-11 Thread Mark Tolonen
"Barak, Ron" wrote in message news:[email protected]... The source of gzip.py on my system seems to suggest that negative seeks are supported: def seek(self, offset): if self.mode == WRITE: if offset < self.offset:

Re: ctype problem

2009-01-13 Thread Mark Tolonen
"Aaron Brady" wrote in message news:6197f37d-0ea0-4430-a466-2f36b2011...@v42g2000yqj.googlegroups.com... On Jan 13, 10:22 am, Grimson wrote: hello out there, I have a problem with c-types. I made a c-library, which expects a pointer to a self defined structure. let the funtion call myfuncti

Re: RegEx issues

2009-01-24 Thread Mark Tolonen
"Sean Brown" wrote in message news:[email protected]... Using python 2.4.4 on OpenSolaris 2008.11 I have the following string created by opening a url that has the following string in it: td[ct] = [[ ... ]];\r\n The ... above is what I'm interested in extracting which is rea

Re: Breaking Python list into set-length list of lists

2009-02-11 Thread Mark Tolonen
"Jason" wrote in message news:8158439d-faae-4889-a1cf-8d9fee112...@v39g2000yqm.googlegroups.com... Hey everyone-- I'm pretty new to Python, & I need to do something that's incredibly simple, but combing my Python Cookbook & googling hasn't helped me out too much yet, and my brain is very, ver

Re: "Byte" type?

2009-02-15 Thread Mark Tolonen
"John Nagle" wrote in message news:[email protected]... Benjamin Peterson wrote: Steve Holden holdenweb.com> writes: Beware, also, that in 2.6 the "bytes" type is essentially an ugly hack to enable easier forward compatibility with the 3.X series ... It's not an ugly

Re: [2.5.1] ShiftJIS to Unicode?

2008-11-27 Thread Mark Tolonen
"Gilles Ganault" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Thu, 27 Nov 2008 01:00:28 +, MRAB <[EMAIL PROTECTED]> wrote: No problem here: >>> import urllib >>> data = urllib.urlopen("http://www.amazon.co.jp/";).read() >>> decoded_data = data.decode("shift-jis") >>> T

Re: generating a liste of characters

2008-12-05 Thread Mark Tolonen
"Yves Dorfsman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Is there any built in way to generate a list of characters, something along the line of range('a'-'z') ? Right now I am using: chars = [ chr(l) for l in range(0x30, 0x3a) ] # 0 - 9 chars += [ chr(l) for l in rang

Re: generating a liste of characters

2008-12-05 Thread Mark Tolonen
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Mark Tolonen: Writing a helper function reduces code repetition and improves readability: def crange(startch,endch): '''Return a list of characters from startch to endch, inclusive.''' return [chr

Re: A more pythonic way of writting

2008-12-05 Thread Mark Tolonen
"eric" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] def flag(IGNORECASE=False, LOCALE=False, MULTILINE=False, DOTALL=False, UNICODE=False, VERBOSE=False): vals = [IGNORECASE, LOCALE, MULTILINE, DOTALL, UNICODE, VERBOSE] filtered = map( lambda m:m[1],filter( lambda m: m[0]

Re: pretty strange behavior of "strip"

2008-12-05 Thread Mark Tolonen
"Guy Doune" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Ok, didn't show the whole problem... I will read the doc anyway, but why "questions.html" keep it "t"?? >>> test=['03.html', '06.html', 'questions.html', '04.html', 'toc.html', '01.html', '05.html', '07.html', '02.html'

Re: pretty strange behavior of "strip"

2008-12-05 Thread Mark Tolonen
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Thu, 4 Dec 2008 at 20:54, Terry Reedy wrote: [snip] I have often wished that in 'split' I could specify a _set_ of characters on which the string would be split, in the same way the default list of whitespace characters causes a s

Re: Python 3.0 automatic decoding of UTF16

2008-12-06 Thread Mark Tolonen
"Johannes Bauer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] John Machin schrieb: On Dec 6, 5:36 am, Johannes Bauer <[EMAIL PROTECTED]> wrote: So UTF-16 has an explicit EOF marker within the text? I cannot find one in original file, only some kind of starting sequence I suppose

Re: operators as variables

2008-12-06 Thread Mark Tolonen
"macc_200" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, just starting programming and have an elementary question after playing around with lists but cannot find >the answer with googling. I have a list of variables and I would like some of those variables to be integers and

Re: Python 3.0 crashes displaying Unicode at interactive prompt

2008-12-13 Thread Mark Tolonen
"John Machin" wrote in message news:a8cd683f-853d-4665-bee4-7a0bdb841...@c36g2000prc.googlegroups.com... On Dec 14, 9:20 am, "Martin v. Löwis" wrote: > >> This is intended behavior. > > > I see. That means that the behaviour in Python 1.6 to 2.6 (i.e. > > encoding the text using the repr() fu

Re: How to display Chinese in a list retrieved from database via python

2008-12-25 Thread Mark Tolonen
"zxo102" wrote in message news:[email protected]... On 12月26日, 上午4时58分, "Gabriel Genellina" wrote: En Thu, 25 Dec 2008 07:27:03 -0200, zxo102 escribió: > On 12月25日, 下午3时35分, "Chris Rebert" wrote: >> On Wed, Dec 24, 2008 at 11:29 PM, zxo102

Re: ctypes & strings

2008-12-27 Thread Mark Tolonen
"Hendrik van Rooyen" wrote in message news:000f01c96822$5c300f00$0d00a...@hendrik... Red Rackham wrote: I would like to pass a string into a dll function. I notice that to pass using ctypes, it has to be a ctypes type. >Looking at the ctypes doc page I don't see a c_string class. The

Re: How to display Chinese in a list retrieved from database via python

2008-12-29 Thread Mark Tolonen
"zxo102" wrote in message news:2560a6e0-c103-46d2-aa5a-8604de4d1...@b38g2000prf.googlegroups.com... I have a list in a dictionary and want to insert it into the html file. I test it with following scripts of CASE 1, CASE 2 and CASE 3. I can see "中文" in CASE 1 but that is not what I want. CAS

Re: How to display Chinese in a list retrieved from database via python

2008-12-29 Thread Mark Tolonen
"zxo102" wrote in message news:[email protected]... On 12月29日, 下午5时06分, "Mark Tolonen" wrote: "zxo102" wrote in message news:2560a6e0-c103-46d2-aa5a-8604de4d1...@b38g2000prf.googlegroups.com... [snip] T

Re: idle 3.0 unicode

2009-01-01 Thread Mark Tolonen
"Pavel Kosina" wrote in message news:[email protected]... As for unicode in Python 2.5 everything works fine in program running either in IDLE or under Command line: # -*- coding: utf-8 -*- print u"ěščřžýáíé" In 3.0 there is an error. The same program, moved to 3.0 syntax, in IDLE e

Re: Nubie question: how to not pass "self" in call to seek() function ?

2009-01-08 Thread Mark Tolonen
"Barak, Ron" wrote in message news:[email protected]... Hi, I am getting the error TypeError: seek() takes exactly 2 arguments (3 given), namely: $ ./_LogStream.py Traceback (most recent call last): File "./_LogStream.py", line 47, in log_str

Re: unicode .replace not working - why?

2008-10-12 Thread Mark Tolonen
In your original code: textu.replace(unichr(167),'\n') as Dennis suggested (but maybe you were distracted by his 'fn' replacement, so I'll leave it out): textu = textu.replace(unichr(167),'\n') .replace does not modify the string in place. It returns the modified string, so you have to

Re: Unicode File Names

2008-10-18 Thread Mark Tolonen
"Jordan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] l = os.listdir(unicode(os.getcwd())) Other options to get the same result: l = os.listdir(os.getcwdu()) l = os.listdir(u'.') Oddly, os.getcwd() and os.getcwdu() both still exist in Python 3.0. Since the behavior is now

Re: Unicode File Names

2008-10-18 Thread Mark Tolonen
""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Oddly, os.getcwd() and os.getcwdu() both still exist in Python 3.0. Since the behavior is now identical it seems os.getcwdu() should be dropped. It is dropped, and os.getcwdb() has been added. Must be changed po

Re: how to call this dll in python

2008-11-03 Thread Mark Tolonen
"Shark" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I have a windows dll1.dll with a export function: int f1(char filename,char **buf,int *bufLen) { int len; //got the length of file anyway,such as 100 len = 100;//len = getLen(filename); *buf = (char*)calloc(100); *bufLen = len

Re: Very simple - please help

2008-11-07 Thread Mark Tolonen
"Chris Rebert" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Fri, Nov 7, 2008 at 8:52 PM, pineapple <[EMAIL PROTECTED]> wrote: I am not a python programmer, but am being forced to port one of my (smalltalk) applications to python for pragmatic reasons (python is embedded with

Re: Where to locate existing standard encodings in python

2008-11-09 Thread Mark Tolonen
"News123" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, I was googling quite some time before finding the answer to my question: 'what are the names for the encodings supported by python?' I found the answer at http://python.active-venture.com/lib/node127.html Now my quest

Re: SocketServer.ThreadingTCPServer accepts clients outside server_forever

2008-11-09 Thread Mark Tolonen
"Okko Willeboordse" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello, SocketServer.ThreadingTCPServer accepts connections (clients can connect) before and after it's server_forever method is called, see below for an example. IMHO it should only accept connections while server

Re: Identifying unicode punctuation characters with Python regex

2008-11-14 Thread Mark Tolonen
"Shiao" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello, I'm trying to build a regex in python to identify punctuation characters in all the languages. Some regex implementations support an extended syntax \p{P} that does just that. As far as I know, python re doesn't. Any ide

Re: Identifying unicode punctuation characters with Python regex

2008-11-14 Thread Mark Tolonen
"Mark Tolonen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] "Shiao" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello, I'm trying to build a regex in python to identify punctuation characters in all the languages. Some rege

Re: Windows PE and Python 2.6 (Side-by-Side error)

2008-11-14 Thread Mark Tolonen
"Werner Merkl" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hallo, I like Python 2.6 and I like to use it anywhere, even within Windows PE. In former version of Python (<= 2.5.x) it was easy to bring it to a Windows PE system: Install Python to Windows XP or Vista and (robo-)

Re: ElementTree XML Namspace

2008-11-14 Thread Mark Tolonen
"Hunter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] We are reviewing a vendor who will output some data in an XML format. I will then use python to convert the data to another format for upload to another vendor. I'm having trouble with very basic steps with the sample file th

Re: Newbie code review of parsing program Please

2008-11-16 Thread Mark Tolonen
"len" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I have created the following program to read a text file which happens to be a cobol filed definition. The program then outputs to a file what is essentially a file which is a list definition which I can later copy and past into

Re: Newbie code review of parsing program Please

2008-11-17 Thread Mark Tolonen
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Mark Tolonen wrote: "len" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [...] You might want to check out the pyparsing library. And you might want to trim your mess

Re: A little comments of ctypes and construct.

2008-11-21 Thread Mark Tolonen
"一首诗" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I didn't try your code. That might be working since it a completely different method. What mean is pack works: = class POINT(Structure): _fields_ = [('x', c_int), ('y', c_int)] p = POINT(1,2) p.x

Re: matching exactly a 4 digit number in python

2008-11-21 Thread Mark Tolonen
"harijay" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I want to parse a number of strings and extract only those that contain a 4 digit number anywhere inside a string Try: p = re.compile(r'\b\d{4}\b') -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: getting at individual bits inside byte field: struct module : bitwise operator

2009-02-23 Thread Mark Tolonen
"harijay" wrote in message news:4c7d58a1-830f-4f02-ba07-aa4910f5f...@b16g2000yqb.googlegroups.com... In my last post I had asked about reading data from a binary file using the struct module. Thanks to some excellent help , I have managed to read in successfully most of the header of this bina

Re: Problem in accessing files with unicode fonts.

2009-02-23 Thread Mark Tolonen
Try os.walk for recursively walking directories. Also if you use a unicode parameter with os.walk or os.listdir you get unicode strings in the result. To run this successfully when you have non-ascii characters in your filenames, you will need to use an environment that supports the characters

Re: Iterator class to allow self-restarting generator expressions?

2009-03-01 Thread Mark Tolonen
"John O'Hagan" wrote in message news:[email protected]... Inspired by some recent threads here about using classes to extend the behaviour of iterators, I'm trying to replace some some top-level functions aimed at doing such things with a class. So far it's got a te

Re: how to convert from network to host byte order

2009-03-05 Thread Mark Tolonen
"Evan" wrote in message news:79582a34-5d0b-49b2-8c1e-4139324ff...@b38g2000prf.googlegroups.com... Hello ~ I'm new with python, what my problem is, I have a binary file, I want to read first 2 bytes and convert it to host byte order, then write it to another file. There is a piece of infor

Re: Stopping SocketServer on Python 2.5

2009-03-10 Thread Mark Tolonen
"David George" wrote in message news:[email protected]... Hi guys, I've been developing some code for a university project using Python. We've been working on an existing codebase, cleaning it up and removing dead wood. We decided to make some changes to internal

Re: Stopping SocketServer on Python 2.5

2009-03-12 Thread Mark Tolonen
"Falcolas" wrote in message news:[email protected]... On Mar 11, 1:11 pm, David George wrote: Again, problem here is the issue of being unable to kill the server while it's waiting on a request. In theory, i could force it to continue by sending

Re: PyWin32 for Python 3.x

2009-03-16 Thread Mark Tolonen
"cgoldberg" wrote in message news:[email protected]... Release 213 is out already: Tim, Mark, this is great news.. thanks for tracking 3.x so closely. I big barrier for me to eventually adopt 3.x is the ability to use pywin32. thanks! -Corey

Re: meta question - how to read comp.lang.python w/o usenet feed/google interface?

2009-03-20 Thread Mark Tolonen
"Esmail" wrote in message news:03081704-17b5-4c7d-82db-8efb7ebce...@q11g2000yqh.googlegroups.com... Hi all, I've been reading/posting to usenet since the 80s with a variety of tools (vn, and most recently Thunderbird) but since my ISP (TimeWarner) no longer provides usenet feeds I'm stuck. I

Re: Generators/iterators, Pythonicity, and primes

2009-04-04 Thread Mark Tolonen
"John Posner" wrote in message news:af9fbcc3a7624599a6f51bad2397e...@amdup... Inspired by recent threads (and recalling my first message to Python edu-sig), I did some Internet searching on producing prime numbers using Python generators. Most algorithms I found don't go for the infinite, cont

Re: Regex similar to "^(?u)\w$", but without digits?

2009-04-11 Thread Mark Tolonen
"Andreas" wrote in message news:[email protected]... > Hello, > > I'd like to create a regex that captures any unicode character, but > not the underscore and the digits 0-9. "^(?u)\w$" captures them also. > Is there a possibility to restrict an exp

Re: regex for multiple whitespace-only lines

2009-04-12 Thread Mark Tolonen
"Phil Mayes" wrote in message news:[email protected]... I am trying to search for 1 or more empty or white-space-only lines. Empty lines work: >>> re.compile('(?m)(^$){1,2}') <_sre.SRE_Pattern object at 0x010F9218> One line with possible whitespace works: >>> re.co

Re: Regex similar to "^(?u)\w$", but without digits?

2009-04-12 Thread Mark Tolonen
"Andreas Pfrengle" wrote in message news:[email protected]... On 12 Apr., 02:31, "Mark Tolonen" wrote: "Andreas" wrote in message news:[email protected]... > Hel

Re: How to access C structures

2009-04-16 Thread Mark Tolonen
"Chris Helck" wrote in message news:[email protected]... I have a couple dozen C structures that define binary file records. I need to read the file and access the records. I need to do this very efficiantly. I am aware of the Python struct class,

Re: iterate to make multiple variables?

2009-04-19 Thread Mark Tolonen
"Tairic" wrote in message news:95ea7bdf-2ae8-4e5e-a613-37169bb36...@w35g2000prg.googlegroups.com... Hi, I'm somewhat new to programming and especially to python. Today I was attempting to make a sudoku-solver, and I wanted to put numbers into sets call box1, box2, ... box9, so that I could che

Re: Question of UTF16BE encoding / decoding

2009-05-04 Thread Mark Tolonen
"Napalmski" wrote in message news:[email protected]... Hello, I have an encoded string in the form "004e006100700061006c006d", if you split on every 4 characters it decodes to a single character. I have come up with this: name = '004e006100700061006c006d' name2

Re: unicode bit me

2009-05-09 Thread Mark Tolonen
wrote in message news:[email protected]... Sorry being unclear again, hmm I am becoming an expert in it. I pasted that code as continuation of my old code at start i.e class A(object): def __unicode__(self): return u"©au" def _

Re: unicode bit me

2009-05-09 Thread Mark Tolonen
"Piet van Oostrum" wrote in message news:[email protected]... "Mark Tolonen" (MT) wrote: MT> wrote in message MT> news:[email protected]... Sorry being unclear again, hmm I am becoming an expert in

Re: import sqlite3

2009-06-04 Thread Mark Tolonen
"willgun" wrote in message news:[email protected]... By the way ,what does 'best regards' means at the end of a mail? I think 恭祝 may be a good translation. -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Using the indent method

2008-05-14 Thread Mark Tolonen
"dj" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello All, I am using elementtree to write an XML document and I am having a hard time adding the correct indentation. I have tried using the indent method, but I can not figure out how to use it. Any suggestions. Using the ver

Re: convert binary to float

2008-06-01 Thread Mark Tolonen
"George Sakkis" <[EMAIL PROTECTED]> wrote in message news:829b1e8f-baac-4ff4-909b->[EMAIL PROTECTED] On Jun 1, 3:55 pm, Mason <[EMAIL PROTECTED]> wrote: I have tried and tried... I'd like to read in a binary file, convert it's 4 byte values into floats, and then save as a .txt file. This works

Re: pythton 调用 so 共享库不能转换参数类型

2008-06-03 Thread Mark Tolonen
"windwiny" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] 我初学python 的 ctypes, 现在的环境是 ubuntu 8.04, Python 2.5.2 (r252:60911, May 7 2008, 15:19:09) , gcc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7) 我创建了一个 so 共享库 - #include double myfd(double x) { return x * 2;} float

Re: ctypes help

2008-06-06 Thread Mark Tolonen
"gianluca" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] hy, I've a huge problem with ctypes. I've compiled my C library and I'd like use it in python with ctype. One function need to pass a pointer to typed ( like this: typedef int value_type). In python I can access to that funt

Re: Parsing a path to components

2008-06-07 Thread Mark Tolonen
"eliben" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Jun 7, 10:15 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: On Fri, 06 Jun 2008 23:57:03 -0700, s0suk3 wrote: > You can just split the path on `os.sep', which contains the path > separator of the platform on which

Re: time module methods give an am or pm value ?

2008-06-07 Thread Mark Tolonen
"dj" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello again, Does anyone know which method in the time module will generate and am or pm ? If none of the method will do this for me. Can I produce the value on my own ? Any suggestions ? from time import * strftime('%I:%M:%S

Re: How to get full path to script?

2008-06-08 Thread Mark Tolonen
"kj" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] How can a script know its absolute path? (__file__ only gives the path it was used to invoke the script.) Basically, I'm looking for the Python equivalent of Perl's FindBin. The point of all this is to make the scripts locat

Re: Iterate creating variables?

2008-06-16 Thread Mark Tolonen
"Hyuga" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Jun 13, 11:34 am, "Reedick, Andrew" <[EMAIL PROTECTED]> wrote: > -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] > Sent: Friday, June 13, 2008 11:11 AM

Re: Accent character problem

2008-06-20 Thread Mark Tolonen
"Sallu" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi all and one i wrote this script, working fine without fail( just run it) import re value='This is Praveen' print value #value = 'riché gerry' #words=str(value.split()).strip('[]').replace(', ', '') ( here i tried to convert

Re: Question: How do I format printing in python

2008-06-23 Thread Mark Tolonen
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi All, How do I format printed data in python? I could not find this in the Python Reference Manual: http://docs.python.org/ref/print.html Nor could I find it in Matloff's great tutorial: http://heather.cs.ucdavis.edu/~matloff/Python

Re: String question

2008-06-23 Thread Mark Tolonen
"Andreu" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Yes, ... don't ask me why, but in fact v1,v2,v3 = str1.split() does not seem to work. My original problem was I forgot about the parenthesis as Tim point out. So I ended up converting to a list as in: v = str1.split() and acc

Re: Getting sorting order

2008-06-30 Thread Mark Tolonen
"leodp" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Or provide a better explanation and an example. Do you mean something like this? Hi Peter, a small example: master=[1,4,3,2] slave1=['d','c','b','a'] slave2=[1,2,3,4] master.sort() # this is ok, but does not return info

Re: ctypes - swig - pointer

2008-06-30 Thread Mark Tolonen
"gianluca" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On 30 Giu, 18:26, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: On Mon, 30 Jun 2008 09:13:42 -0700 (PDT), gianluca <[EMAIL PROTECTED]> wrote: >I've a problem with dll function colled with python/ctypes. My >functions (C)

Re: The Yield statement

2008-07-06 Thread Mark Tolonen
"inhahe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] "Alex Bryan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Okay, so i don't really understand the Yield thing and i know it is useful. I've read a few things about it but it is all programming jargon and so

Re: how are strings immutable in python?

2008-07-06 Thread Mark Tolonen
"ssecorp" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] so if strings were mutable and i did a = b = "foo" and then did a += "bar" then a and b would be foobar? This can be demonstrated with a list of characters, which *is* mutable: a = b = list('foo') a += list('bar') a ['f'

Re: Python pack and unpack question

2008-07-14 Thread Mark Tolonen
"joe shoemaker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] If you have the following: data = unpack('>L', sock.recv(4)) Does this line of code means that incoming data is big endian and unpack it to endianess of local machine? If local machine is little endian, then big

Re: Unicode confusion

2008-07-15 Thread Mark Tolonen
"Jerry Hill" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Mon, Jul 14, 2008 at 12:40 PM, Tim Cook <[EMAIL PROTECTED]> wrote: if I say units=unicode("°"). I get UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128) If I try x=unico

Re: getting with statement to deal with various exceptions

2008-07-20 Thread Mark Tolonen
"mk" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello, I'm trying to learn how with statement can be used to avoid writing: prepare() try: something_that_can_raise_SomeException() except SomeException, err: deal_with_SomeException finally: tear_it_down() Verbose, not very re

Re: imported module no longer available

2008-07-21 Thread Mark Tolonen
"Jeff Dyke" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I've come across an error that i'm not yet able to create a test case for but wanted to get see if someone could shed light on this. I have imported a module at the top of my file with import mymodulename this module is u

Re: ctypes and reading value under pointer passed as param of a callback

2008-07-25 Thread Mark Tolonen
"waldek" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Jul 24, 5:01 pm, Thomas Heller <[EMAIL PROTECTED]> wrote: waldekschrieb: > Hi, > I'm using C dll with py module and wanna read value (buffer of bytes) > returned in py callback as parameter passed to dll function. The c

Re: Receive data from socket stream

2008-04-27 Thread Mark Tolonen
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Apr 26, 7:25 am, Irmen de Jong <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] wrote: > Until now, I've been > doing this little trick: > data = client.recv(256) > new = data > while len(new) == 256: > new = client.recv(256) >

Re: How to print first(national) char from unicode string encoded inutf-8?

2008-09-01 Thread Mark Tolonen
"Marco Bizzarri" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Mon, Sep 1, 2008 at 3:25 PM, <[EMAIL PROTECTED]> wrote: When I do ${urllib.unquote(c.user.firstName)} without encoding to latin-1 I got different chars than I will get: no Łukasz but Å ukasz -- http://mail.pytho

Python 3.0 and repr

2008-09-28 Thread Mark Tolonen
I don't understand the behavior of the interpreter in Python 3.0. I am working at a command prompt in Windows (US English), which has a terminal encoding of cp437. In Python 2.5: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win 32 Type "help", "copyr

Re: Music knowledge representation

2008-09-28 Thread Mark Tolonen
"Mr.SpOOn" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Sun, Sep 28, 2008 at 8:59 PM, Aaron Castironpi Brady <[EMAIL PROTECTED]> wrote: Here is a link to someone else's design they asked about on the newsgroup a couple weeks ago. http://groups.google.com/group/comp.lang.pyt

Re: Python 3.0 and repr

2008-09-28 Thread Mark Tolonen
""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] What are others' opinions? Any insight to this design decision? The intention is that all printable characters in a string get displayed in repr. This was in particular requested by Japanese users (but also by ot

  1   2   >