Re: [Tutor] create an object from a class in dll with ctypes?

2010-01-19 Thread Mark Tolonen
"katrin schmid" wrote in message news:0edda7dddff84d639352526b72dbf...@katissspc... hi, i am getting started with ctypes in python 2.5 and was wondering if i would be able to create an object from the class in my dll somehow. I only found examples that show how to access a function but the fun

Re: [Tutor] Python workspace - IDE and version control

2010-01-19 Thread Mark Tolonen
"Kent Johnson" wrote in message news:1c2a2c591001190905u28db4464hc1d1461ad26e9...@mail.gmail.com... On Tue, Jan 19, 2010 at 9:12 AM, Andreas Kostyrka wrote: The cool part about git that I've not yet replicated with hg is git add -p which allows you to seperate out different changes in the

Re: [Tutor] create an object from a class in dll with ctypes?

2010-01-22 Thread Mark Tolonen
"katrin schmid" wrote in message news:20100123021522.155...@gmx.net... hi, so how about 32 and 64 bit, do they need separat versions, too? So a pyd is an "actual" dll? Regrads, katrin Yes, to both questions. -Mark ___ Tutor maillist - Tutor@py

Re: [Tutor] Python 3.0

2010-02-20 Thread Mark Tolonen
"bob gailer" wrote in message news:4b7fea0e.6000...@gmail.com... On 2/20/2010 5:52 AM, Paul Whittaker wrote: Using the following script, the (Windows 7) PC echoes the key presses but doesn't quit (ever!) import msvcrt print('Press SPACE to stop...') while True: k = msvcrt.getch()

Re: [Tutor] How to wrap ctype functions

2010-03-05 Thread Mark Tolonen
"Jan Jansen" wrote in message news:f17500b71003030943w606925edie41b41d6d64ef...@mail.gmail.com... Hi there, I wonder what's the best way to wrap given function calls (in this case ctype function calls but more generally built-in functions and those kinds). I have a huge c library and almost

Re: [Tutor] Encoding

2010-03-05 Thread Mark Tolonen
"Giorgio" wrote in message news:23ce85921003050915p1a084c0co73d973282d8fb...@mail.gmail.com... 2010/3/5 Dave Angel I think the problem is that i can't find any difference between 2 lines quoted above: a = u"ciao è ciao" and a = "ciao è ciao" a = unicode(a) Maybe this will help: # co

Re: [Tutor] Searching for time in a given string

2010-04-01 Thread Mark Tolonen
"Judith Flores" wrote in message news:27451.74230...@web113808.mail.gq1.yahoo.com... Hello, I was wondering if someone could provide me with the pattern syntax to find the time in a given string. The time usually appears as "14:28:32" (for example) within a string ("Sun Jan 23 14:28:32 19

Re: [Tutor] Sequences of letter

2010-04-11 Thread Mark Tolonen
"Juan Jose Del Toro" wrote in message news:s2i9b44710e1004112212zdf0b052fxe647ba6bb9671...@mail.gmail.com... Dear List; I have embarked myself into learning Python, I have no programming background other than some Shell scripts and modifying some programs in Basic and PHP, but now I want to b

Re: [Tutor] Python 2.5.4 - error in rounding

2010-05-21 Thread Mark Tolonen
"Alan Gauld" wrote in message news:ht6v97$63...@dough.gmane.org... "Neven Gorsic" wrote I run into Python error in rounding and not know how to predict when it will occur in order to prevent wrong result. It depends how you define wrong. When I was at scvhool the rules f or rounding dec

Re: [Tutor] Problem with input() and unicode string

2010-07-28 Thread Mark Tolonen
"Alan Gauld" wrote in message news:i2pqps$fp...@dough.gmane.org... "Alex" wrote The first print statement works as expected, both in IDLE and when double-clicking the file for a console view. The second one works in IDLE, but just flashes by when double-clicking the file, due to an error

Re: [Tutor] Python Help - How to end program

2010-07-28 Thread Mark Tolonen
"Jason MacFiggen" wrote in message news:aanlktinevw8zje7fxktomks+tbrp=trmb7sb7pbkt...@mail.gmail.com... Python keeps looping when it gets past the int 0, how do I end the program when it the int 0 or > 0. my_hp = 50 mo_hp = 50 my_dmg = random.randrange(1, 20) mo_dmg = random.randrang

Re: [Tutor] Looking for a tutor to review my code and provideconstructive feedback.

2010-11-05 Thread Mark Tolonen
"Glen Clark" wrote in message news:aanlktimabbj8ae35q3ao9+xzbvtnyzbz3wrudahmn...@mail.gmail.com... Hello, I have completed my first python script. This is after watching a video guide on python and is my first attempt at writing code in python. While the code is not very useful I got the ide

Re: [Tutor] Removing control characters

2009-02-19 Thread Mark Tolonen
A regex isn't always the best solution: >>> a=''.join(chr(n) for n in range(256)) >>> a '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./0123456789:;<=>?...@abcdefghijklmnopqrstuvwxyz[\\]^_`abcdefghijklmno

Re: [Tutor] Removing control characters

2009-02-19 Thread Mark Tolonen
"Kent Johnson" wrote in message news:1c2a2c590902191500y71600feerff0b73a88fb49...@mail.gmail.com... On Thu, Feb 19, 2009 at 5:41 PM, Dinesh B Vadhia wrote: Okay, here is a combination of Mark's suggestions and yours: # replace unwanted chars in string s with " " t = "".join([(" " if n in

Re: [Tutor] new print statement + time module

2009-02-27 Thread Mark Tolonen
"spir" wrote in message news:20090228081629.36a24...@o... Le Sat, 28 Feb 2009 06:34:07 +0200, George Wahid s'exprima ainsi: I downloaded python 3.0.1 today and started experimenting with the new print statement. >>>import time >>>for l in 'the answer': ...print(l,end='') ...time.sl

Re: [Tutor] TypeError: dict objects are unhashable

2009-03-14 Thread Mark Tolonen
wrote in message news:16014207.1237036582618.javamail.r...@ps26... hi, i have a list which contains duplicate dictionaries. how do i extract the unique items out? l1 = [{'a': 'ddd'}, {'a': 'ddd'}, {'b': 'eee'}, {'c': 'ggg'}] set(l1) TypeError: dict objects are unhashable but, {'a': 'ddd'}

Re: [Tutor] Opening a cmd.exe

2009-03-22 Thread Mark Tolonen
"Tim Golden" wrote in message news:49c65068.2080...@timgolden.me.uk... Tim Golden wrote: Alan Gauld wrote: "Sigga Sig" wrote I am writing a code that is supoesed to act as routers and i need to open a different cmd window for each one of them with it's name and so on. I do not know how

Re: [Tutor] irregular/parse/sort

2009-03-22 Thread Mark Tolonen
wrote in message news:d08.50baad3e.36f80...@aol.com... I've been using re.sub() to try and take the below pattern1 and convert it to pattern2 (which are below) below that is mycode1. Does anyone have any suggestions as to how I can figure this out? pattern1 NTR+A0001 0.01 GLU-A0003 8.21 GLU-A0

Re: [Tutor] Syntax error

2009-03-22 Thread Mark Tolonen
It is helpful to know the exact error message (cut and paste) and the version of Python you are using. In Python 3.x the print statement would produce a syntax error. In any Python "raw input" is a syntax error. "raw_input" is the correct function name, unless you are using 3.x where it was r

Re: [Tutor] how are unicode chars represented?

2009-03-30 Thread Mark Tolonen
"Kent Johnson" wrote in message news:1c2a2c590903300352t2bd3f1a7j5f37703cf1c3...@mail.gmail.com... On Mon, Mar 30, 2009 at 3:36 AM, spir wrote: Everything is in the title ;-) (Is it kind of integers representing the code point?) Unicode is represented as 16-bit integers. I'm not sure, but

Re: [Tutor] how are unicode chars represented?

2009-03-31 Thread Mark Tolonen
"Kent Johnson" wrote in message news:1c2a2c590903310357m682e16acr9d94b12b60993...@mail.gmail.com... On Tue, Mar 31, 2009 at 1:52 AM, Mark Tolonen wrote: Unicode is simply code points. How the code points are represented internally is another matter. The below code is from a 16-b

Re: [Tutor] Formatting zip module arguments correctly

2009-04-05 Thread Mark Tolonen
The error indicates your source file cannot be read. Did you have it open in an editor that locks it for exclusive use when you ran your program? Also, the command: zipfile.ZipFile(target, 'w').write(source) writes backup_list to the target zipfile, and returns None, assigning the return

Re: [Tutor] Please use plain text.

2009-04-06 Thread Mark Tolonen
Signature.htmlI normally reply in whatever the original poster uses, because when I convert HTML to plain text it removes all the attribution indentation, making it difficult to tell who wrote what (see below...I converted this post back to plain text). HTML is generally painful to read unless

Re: [Tutor] Optional groups in RE's

2009-04-11 Thread Mark Tolonen
"Moos Heintzen" wrote in message news:7b13ba330904111546n21d90202i7572a75c55b02...@mail.gmail.com... > Hello Tutors! > > I was trying to make some groups optional in a regular expression, but > I couldn't do it. > > For example, I have the string: > data = "42 sdlfks d f60 sdf sdf Tit

Re: [Tutor] Encode problem

2009-05-04 Thread Mark Tolonen
"spir" wrote in message news:20090501220601.31891...@o... Le Fri, 1 May 2009 15:19:29 -0300, "Pablo P. F. de Faria" s'exprima ainsi: self.cfg.write(codecs.open(self.properties_file,'w','utf-8')) As one can see, the character encoding is explicitly UTF-8. But ConfigParser keeps trying to sa

Re: [Tutor] Encode problem

2009-05-05 Thread Mark Tolonen
"Kent Johnson" wrote in message news:1c2a2c590905050337j1afc177ene64f800dcc3a7...@mail.gmail.com... On Tue, May 5, 2009 at 1:14 AM, Mark Tolonen wrote: > The below works. ConfigParser isn't written to support Unicode > correctly. I > was able to get Unicode secti

Re: [Tutor] quick question to open(filename, 'r') vs. file(filename, 'r')

2009-05-05 Thread Mark Tolonen
"W W" wrote in message news:333efb450905050408m48246dd8wc90b94880898e...@mail.gmail.com... On Tue, May 5, 2009 at 5:41 AM, spir wrote: Le Tue, 5 May 2009 00:41:39 +0100, "Alan Gauld" s'exprima ainsi: > > Backwards compatibility. The file type was introduced in python 2.2, > > before whic

Re: [Tutor] unicode, utf-8 problem again

2009-06-04 Thread Mark Tolonen
"Dinesh B Vadhia" wrote in message news:col103-ds25bb23a18e216061c32eb1a3...@phx.gbl... Hi! I'm processing a large number of xml files that are all declared as utf-8 encoded in the header ie. My Python environment has been set for 'utf-8' through site.py. It's a bad idea to change th

Re: [Tutor] Need better understanding of **kwargs

2009-06-06 Thread Mark Tolonen
"Eduardo Vieira" wrote in message news:9356b9f30906061044i4ded250fif3b387e64a117...@mail.gmail.com... Hello, I thought I understood **kwargs until I stumbled with this function: def changeflexion(myword, mytag, **dicty): global er_verbs global ar_verbs global ir_verbs #global di

Re: [Tutor] Writing a csv from a dictionary

2009-06-22 Thread Mark Tolonen
"Eduardo Vieira" wrote in message news:9356b9f30906221404o7a7c5e5dt3d59e7b6d40ac...@mail.gmail.com... Hello, I have a dictionary similar to this: dyc = { 'a50' : ['textfield', 50, 40], 'k77' : ['othertext', 60, 10] } I was trying to write a csv with the csv module, by doing this: import csv m

Re: [Tutor] Writing a csv from a dictionary

2009-06-23 Thread Mark Tolonen
"Kent Johnson" wrote in message news:1c2a2c590906230415q351c7c74kebc591907ce0e...@mail.gmail.com... On Tue, Jun 23, 2009 at 1:08 AM, Mark Tolonen wrote: import csv dyc = { 'a50' : ['textfield', 50, 40], 'k77' : ['othertext', 60,

Re: [Tutor] About the vertical bar input

2009-06-29 Thread Mark Tolonen
"hyou" wrote in message news:blu143-ds478a37dc2b1db050e5b96c4...@phx.gbl... Hello, I'm trying to write a script that simply execute a command line like: C:\...(path)..\Devenv solution /build "Debug|Win32" However, in Python the "|" symbol is reserved thus I just can't make the command line

Re: [Tutor] Need help with python game program

2009-06-30 Thread Mark Tolonen
"jonathan wallis" wrote in message news:57b8984c0906301738w1fb0e660m6bb2123399f27...@mail.gmail.com... My problem is simple, is their a way to make a variable equal multiple numbers? Such as X = 5 through 10, and then the program makes x equal something random 5 through 10, or something simil

Re: [Tutor] window graphics

2009-07-03 Thread Mark Tolonen
"David H. Burns" wrote in message news:4a4d65e5.3040...@cherokeetel.net... Thanks, Alan, With the Python3.0, I have installed, he entry "from tkinter import *" doesn't produce any error message, but "tk = TK()" results in "NameError: 'TK' is not defined". Also for the word "canvas" As yo

Re: [Tutor] UnicodeEncodeError

2009-07-19 Thread Mark Tolonen
"gpo" wrote in message news:24554280.p...@talk.nabble.com... I'm doing a simple excercise in reading a file, and printing each line. However, I'm getting this error. The file is a windows txt file, ecoded in ANSI(ascii). I don't understand why Pythin is displaying a Unicode error. Here i

Re: [Tutor] UnicodeEncodeError

2009-07-19 Thread Mark Tolonen
"Alan Gauld" wrote in message news:h407ah$lc...@ger.gmane.org... "Mark Tolonen" wrote ... I see you are using Python 3.1. ... You can also use a shell that supports the full Unicode character set such as Idle or PythonWin instead of the console. As a matter of int

Re: [Tutor] What kind of number is this

2009-07-25 Thread Mark Tolonen
"Emad Nawfal (عماد نوفل)" wrote in message news:652641e90907250514m1566287aq75f675fd63360...@mail.gmail.com... On 7/25/09, Dave Angel wrote: Emad Nawfal (9E'/ FHAD) wrote: Hi Tutors, I have a bunch of text files that have many occurrences like the following which I believe, given the cont

Re: [Tutor] mapping/filtering a sequence

2009-09-05 Thread Mark Tolonen
"Douglas Philips" wrote in message news:6a3250c7-31b6-4958-8e0a-f538989ed...@mac.com... On or about 2009 Sep 5, at 10:45 AM, Martin A. Brown indited: Have you discovered the map() builtin yet? I would imagine that others on this list will have some even more elegant and efficient solutions f

Re: [Tutor] mapping/filtering a sequence

2009-09-05 Thread Mark Tolonen
"Douglas Philips" wrote in message news:9ee00578-6af7-4c6c-9968-af5f25a00...@mac.com... On 2009 Sep 5, at 12:22 PM, Mark Tolonen wrote: As a list comp: L=range(30,41) [{38:34,40:39}.get(n,n) for n in L] [30, 31, 32, 33, 34, 35, 36, 37, 34, 39, 39] True, that is terse, bu

Re: [Tutor] how can I append a iteration to a tow dimensional array

2009-09-19 Thread Mark Tolonen
"Rayon" wrote in message news:bay122ds664a5c474fbf157089866c3...@phx.gbl... how can I append a iteration to a tow dimensional array so that one value can be like a key in a dir. It's unclear what behavior you are looking for, but there are a number of errors in your code below. Describe wh

Re: [Tutor] How to perform variable assignment and

2009-10-03 Thread Mark Tolonen
"wesley chun" wrote in message [snip] ... however, there is a tiny bug: if the $HOME environment variable is *not* set, you will get a KeyError exception. one solution is to add a default value to your get() method call so that it returns an object with a Boolean False value: No KeyError. D

Re: [Tutor] Changing text colors on WinXP py2.6.2

2009-10-13 Thread Mark Tolonen
"Tim Golden" wrote in message news:4ad471e6.7050...@timgolden.me.uk... Alan Gauld wrote: "Tim Golden" wrote No. ANSI escapes don't work on Windows. Wouldn't the ANSI codes work if ANSI.SYS were loaded? I thought you could still load ANSI.SYS it just wasn't normally there? The help system

Re: [Tutor] Being beaten up by a tuple that's an integer thats a tuple that may be an unknown 'thing'.

2009-11-03 Thread Mark Tolonen
"Robert Berman" wrote in message news:1257261606.29483.23.ca...@bermanrl-desktop... In [69]: l1=[(0,0)] * 4 In [70]: l1 Out[70]: [(0, 0), (0, 0), (0, 0), (0, 0)] In [71]: l1[2][0] Out[71]: 0 In [72]: l1[2][0] = 3 --- T

Re: [Tutor] getting python 3 to run from the command line

2009-11-14 Thread Mark Tolonen
"Khalid Al-Ghamdi" wrote in message news:dfac564f0911140040y27e0bee5ub02aa2de2b02f...@mail.gmail.com... Hi, for some reason I haven't been able to get python 3 to work from the the command line. I've added it to the the path in the the system variables but still no luck. when I try to run p

Re: [Tutor] getting python 3 to run from the command line (version 2)

2009-11-14 Thread Mark Tolonen
"Khalid Al-Ghamdi" wrote in message news:dfac564f0911140854v42fa4e0ehe5868517a50ef...@mail.gmail.com... hi all, I realize my question was previous question was phrased, well, vaguely, as I learn from your responses so here's version 2 of my question: i'm running windows vista and have pyth

Re: [Tutor] getting python 3 to run from the command line (version2)

2009-11-15 Thread Mark Tolonen
Forgive the top-posting, but when in Rome... Running 'chcp' at the command line will show the default code page. Judging from the OP's name it is probably an Arabic version of Windows. Since Python 2.6 works it probably is falling back to something besides cp720. Try: import sys print

Re: [Tutor] Send Hex

2009-12-18 Thread Mark Tolonen
"Григор" wrote in message news:acd355e80912180634l1c7a545fo7be9d5e99138b...@mail.gmail.com... Hi Can I send date and time like Hex in to the Serial port or file. from time import * It preferable to just use "import time" import time def TimeMake():

Re: [Tutor] Expanding a Python script to include a zcat and awkpre-process

2010-01-08 Thread Mark Tolonen
wrote in message news:5dff81f3-a087-41f2-984b-914a08e2b...@gmail.com... I wrote a simple Python script to process a text file, but I had to run a shell one liner to get the text file primed for the script. I would much rather have the Python script handle the whole task without any pre-pr

Re: [Tutor] seeking help to a problem w/ sockets

2008-04-27 Thread Mark Tolonen
"James Duffy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [snip] def close( this ): #close all connections and sockets this.conn.close() this.sock.close() def process( this ): #this is the loop of the thread, it listens, receives, closes then repeats

Re: [Tutor] Tutorial indicating different output

2008-05-08 Thread Mark Tolonen
"Eric Morey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello everyone, I have no prior experience with programing. I've just started with the Python tutorial at http://www.dickbaldwin.com/tocpyth.htm. On the section that describes decimal division on this page: http://www.d

Re: [Tutor] How to make a python binding for a c library?

2008-05-12 Thread Mark Tolonen
"tuyun" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi I have a library written in C, I want to make a python binding for it. But I dont know how to get started. Is there any guide or document? Is "Python/C API Reference Manual" the right doc I need to study first? Check out t

Re: [Tutor] Newbie: Sorting lists of lists

2008-06-19 Thread Mark Tolonen
"Kent Johnson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Wed, Jun 18, 2008 at 8:30 PM, Keith Troell <[EMAIL PROTECTED]> wrote: Let's say I have a list of lists l == [[1, 2, 3], [2, 3, 1], [3, 2, 1], [1, 3, 2]] If I do a l.sort(), it sorts on the first element of each lis

Re: [Tutor] For Loop question

2008-06-26 Thread Mark Tolonen
"Lie Ryan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Thu, Jun 26, 2008 at 3:18 AM, Dick Moores <[EMAIL PROTECTED]> wrote:  Hi I'm learning FOR loop now, very easy too learn. But I get confused to understand this code : myList = [1,2,3,4] for index in range(len(myList)):

Re: [Tutor] need help with a regular expression

2008-06-28 Thread Mark Tolonen
"Kelie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello, I'm trying to write a regular expression to filter strings that meet the following criteria: 1. Starts with 0-3 underscores; 2. Followed by one letter; 3. Then followed by 0 or more letters or digits or hyphens('-'), 4

Re: [Tutor] arrays in python

2008-06-28 Thread Mark Tolonen
"Kirk Z Bailey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Just wondering, if I can find a way to do a 2 dimensional array in python. 1 dimension would be a list it would seem; for 2, I could use a list of lists? Strange how I can't think of ever needing one since I discover

Re: [Tutor] Deleting specified files using a python program...help withcode?

2008-06-29 Thread Mark Tolonen
"Saad Javed" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I transfer files a lot between my windows and linux partitions...these folders sometimes contain *.db and *.ini files which are not recognized or used by linux. So i tried to write a program to crawl through my home dir and

Re: [Tutor] Fibonacci series(perhaps slightly off topic)

2008-07-03 Thread Mark Tolonen
You can actually remove the try/except, because if the calculation key-len(self.fibsseq)+1 <= 0 the for loop won't execute. The for loop will make sure self.fibsseq is long enough to satisify the return self.febsseq[key] access: class Fibs(object): def __init__(self): self.fibsseq =

Re: [Tutor] manipulating a string

2008-07-15 Thread Mark Tolonen
"Bryan Fodness" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I have a string (column names) that I need to split. D_H = 'D 5 10 15 20 25 30 35 40 D Upper D Lower' I cannot do a simple list(D_H).split because the last two strings have a space between them (D Upper and D Lower a

Re: [Tutor] Unittest

2008-07-16 Thread Mark Tolonen
The Exception is output in the encoding of the source file. If the terminal you are displaying the exception on is in a different encoding, it will be garbled. I'm not familiar with OS X's terminal. Try running python and printing sys.stdout.encoding. Alternatively, wrap your code in a try/e

Re: [Tutor] Unittest

2008-07-16 Thread Mark Tolonen
;> Traceback (most recent call last): File "/var/folders/PC/PCtFE4gQGiqpQymiAScfnk+++TM/-Tmp-/py46506ECT", line 7, in print traceback.format_exc().decode('utf-8') UnicodeEncodeError: 'ascii' codec can't encode characters in position 148-156: ordinal not in range

Re: [Tutor] Unittest

2008-07-17 Thread Mark Tolonen
ceback.format_exc().decode('utf-8') >>> Traceback (most recent call last): File "/var/folders/PC/PCtFE4gQGiqpQymiAScfnk+++TM/-Tmp-/py46506ECT", line 7, in print traceback.format_exc().decode('utf-8') UnicodeEncodeError: 'ascii

Re: [Tutor] Raw string

2008-07-21 Thread Mark Tolonen
"Neven Gorsic" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Mon, Jul 21, 2008 at 9:44 AM, Monika Jisswel <[EMAIL PROTECTED]> wrote: instead of s='e:\mm tests\1. exp files\5.MOC-1012.exp' try to use : s = r'e:\mm tests\1. exp files\5.MOC-1012.exp'.replace( '\\', '') for m

Re: [Tutor] print the hole unicode list

2008-08-28 Thread Mark Tolonen
"Yang" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello, I am trying to print out the hole unicode char list in window! form 0-65535. I use the winxp in simple chinese LOCAL! the ascii form 0-127 and CJK chars form 0X4E00-0X9FA4 can be print out! Other ucode chars case th

Re: [Tutor] Downloading Files from the net

2008-09-28 Thread Mark Tolonen
"Timo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] What is the best/correct way to download files from a webpage? www.example.com/example.mp3 for instance. I know how to open the site (with urllib), but have no idea how to write the file to the harddisk. Quick and dirty, if e

Re: [Tutor] python regex help

2008-09-28 Thread Mark Tolonen
"Arun Tomar" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Sun, 2008-09-28 at 17:26 +0100, Alan Gauld wrote: "Arun Tomar" <[EMAIL PROTECTED]> wrote > I've been using shell scripting & using sed & pipes i've solved it, > but with python, i need to practice more ;). ok, i got it

Re: [Tutor] Edit a Word document programmatically

2008-10-14 Thread Mark Tolonen
These two lines connect to Word. The EnsureDispatch makes sure Word constants work later: >>> import win32com.client >>> word = win32com.client.gencache.EnsureDispatch('Word.Application') Then record a Word macro to do what you want (this was a find/replace all): Selection.Find.ClearFormat

Re: [Tutor] appending to a utf-16 encoded text file

2008-10-21 Thread Mark Tolonen
"Tim Golden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Tim Brown wrote: Hi, I'm trying to create and append unicode strings to a utf-16 text file. The best I could come up with was to use codecs.open() with an encoding of 'utf-16' but when I do an append I get another UTF16

Re: [Tutor] List of lists help

2008-11-20 Thread Mark Tolonen
"Alan Gauld" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [snip] Something like L = [[0,0,0] *3] I think you meant: [[0,0,0]]*3 [[0, 0, 0], [0, 0, 0], [0, 0, 0]] -Mark Now L contains 3 copies of the same list so when you change any one copy it is reflected in all of

Re: [Tutor] extend my re

2008-11-22 Thread Mark Tolonen
"Ricardo Aráoz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, I've got a half working re but I can't find a way to give it the final touch. Let's say I have (it would actually be source code file) : import re MyString = """Algo ... Start ... otro ... comment ...

Re: [Tutor] accessing list from a string

2008-11-25 Thread Mark Tolonen
"Bryan Fodness" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I have a list in a text file that is in the python format., Positions = [2.5,2.8] and would like to grab the values. for line in file('list.txt'): if line == Positions: x1,x2=Positions I kn

Re: [Tutor] Working with lists

2008-12-13 Thread Mark Tolonen
wrote in message news:20081213095244.n4clmwk3k4gkg...@webmail4.isis.unc.edu... Hi everyone, I seem to use this pattern alot when writing functions and I'm wondering if there is a more efficient method. It comes up whenever I want to work with more than one item in a list; for instance, say

Re: [Tutor] Reading module to import from a string

2008-12-16 Thread Mark Tolonen
"Shrutarshi Basu" wrote in message news:376fbdcf0812151438w53c8f3f7rc1dc481b52428...@mail.gmail.com... Suppose I have a module that I want to import called ImMod1 that's saved in a variable like so: var = "ImMod1" Is there some way to import ImMod1 by using var? Thanks, Basu mod = __import

Re: [Tutor] to sort

2008-12-25 Thread Mark Tolonen
"prasad rao" wrote in message news:9e3fac840812252221pe3345bam7e3e3563e050c...@mail.gmail.com... hello I am trying to sort a list(I know there is a builtin sort method). a=[21,56,35,47,94,12] b=[] for x in a: b.append (min(a)) a.remove (min(a)) >>> a [56, 47, 94] >>> b

Re: [Tutor] Better way - fnmatch with list ? CORRECTION

2009-01-03 Thread Mark Tolonen
"Damon Timm" wrote in message news:262679b50901031327n23b2f754l62fe0cf98751c...@mail.gmail.com... On Fri, Jan 2, 2009 at 7:16 PM, Jervis Whitley wrote: for fn in files: base, ext = os.path.splitext(fn) if ext.lower() in ['.flac', '.mp3', '.mp4']: takes into account systems with case sen

Re: [Tutor] Deleting recursive folder definition

2009-01-12 Thread Mark Tolonen
"Alan Gauld" wrote in message news:50c11a8b9db748fa9e6e892067cce...@xp... I've managed to do something incredibly stupid on my XP box. I've created a folder that is a link to itself - at least I think that's what has happened, it was a CASE tool that I was using that actually did the damage.

Re: [Tutor] Date comparison across time zones

2009-01-13 Thread Mark Tolonen
"frenc1z 1z" wrote in message news:7b60d8a80901130845s30842deeuba55afec99285...@mail.gmail.com... Hello, I'm a novice python (python 2.6.1) user with the following problem. Never though this was going to be so difficult :-). I would like to compare some dates (date+time really). The dates a

Re: [Tutor] Concerning Programming Exercise #6 of Chapter 2 of Python Programming John Zelle Textbook

2009-01-20 Thread Mark Tolonen
Since you are updating the principal value each year, use the following to grow the principal by the interest rate each year: principal = principal * (1 + apr) -Mark "bob gailer" wrote in message news:49761fdc.5020...@gmail.com... Donna Belle Ibarra wrote: Hi! I need help with program

Re: [Tutor] dict() versus {}

2009-01-21 Thread Mark Tolonen
This: >>> dict(one=1,two=2,three=3) {'three': 3, 'two': 2, 'one': 1} Is a shortcut for the longer: >>> dict((('one',1),('two',2),('three',3))) {'three': 3, 'two': 2, 'one': 1} and given how this works: >>> def function(**kwargs): ... print kwargs ... >>> function(one=1,two=2,three=3) {'thre

Re: [Tutor] process and modify a list of strings, in place

2011-02-11 Thread Mark Tolonen
"John Martinetti" wrote in message news:AANLkTi=8kvksqzpujsqwffj8yarjcwhuhawtzkzfv...@mail.gmail.com... Hello - I'm a novice programmer, not even amateur level and I need some help with developing an algorithm to process a list of strings. I hope this list is tolerant of n00bs, if not, please

Re: [Tutor] python ctypes dll issue

2011-05-09 Thread Mark Tolonen
"mammar" wrote in message news:BANLkTin90dmfRkBu5O=dz-p36fp3nl_...@mail.gmail.com... Hi All, I have created a DLL with the following function exported in it int myFunction(char *id, char *name); Below is the python code to load the dll and call myFunction from ctypes import * # Load DL

Re: [Tutor] trying to translate and ebcidic file

2011-06-15 Thread Mark Tolonen
"Prinn, Craig" wrote in message news:6b49a56a6e493f4eba255f6f197f070f050e4fe...@bbh-mail1.bbh.priv... I am looking for a way to translate and ebcidic file to ascii. Is there a pre-existing library for this, or do I need to do this from scratch? If > from scratch and ideas on where to start?

Re: [Tutor] Socket Programming issue

2011-06-21 Thread Mark Tolonen
"aditya" wrote in message news:BANLkTikS+gzm=89thczpbwksd+wufec...@mail.gmail.com... This is a small client-server program in which i am using a Vbscript program to check for connectivity of 2 machines and write the output to a text file whether it connectes or not , for example the conten