[Tutor] Environment Variables On Windows

2004-12-26 Thread Mark Kels
Hello to all :-) I'm writing a CGI script (one of my first ever CGI programs and I'm using this tutor to learn CGI: http://www.oreilly.com/openbook/cgi/ This isn't a python tutor, but the introductions says that any language will be good for this tutor. Anyway, I got to the Using Environment Varia

Re: [Tutor] Environment Variables On Windows

2004-12-26 Thread Mark Kels
> Morning Mark, > > Happy New Year, Merry Christmas, and a jolly Winter Solstice Season! > > Whenever you're talking about how to do something in Windows it REALLY > helps when you include WHICH windows you're working with. > > I believe the following wi

[Tutor] re.compile and objects - what am doing wrong?

2004-12-27 Thread Mark Boydell
Been a long time since I last posted to the list so this is only my third program in as many years :( Anyway the basic idea is to look through two csv files (seperated by tabs) enter both of them into dictionaries and compare the keys of the "polished" version with the "rough" one. If I've already

Re: [Tutor] re.compile and objects - what am doing wrong?

2004-12-27 Thread Mark Boydell
Wow - List comprehensions does make the problem one heck of a lot easier on the eye and doesn't really remove much of it's comprhension. Thanks for the tips Jacob and Alan - It's always fascinating to see what seems like complicated problems set out so neatly and clearly on the list :)

[Tutor] Looking for a project participate in (a little OT)

2005-01-06 Thread Mark Kels
I'm learning python for a few months now, and I would like to get some experience by participating in a good, open source, and small python-CGI project. I searched freshmeat.net but couldn't find anything interesting (except __ but I think its dead...). Anyone knows of a good small and open source

[Tutor] Problem with a variable in a CGI program

2005-01-07 Thread Mark Kels
HI all ! I started to read the following code (I will start working on it when this problem is fixed) and it looks OK while I read it. But for some reason it doesn't work... Here is the code: # MailList is copyright (c) 2000 of Programmed Integration # You may use this code in any way you see fit,

Re: [Tutor] Problem with a variable in a CGI program

2005-01-07 Thread Mark Kels
On Fri, 7 Jan 2005 11:16:29 -0800 (PST), Danny Yoo <[EMAIL PROTECTED]> wrote: > > > On Fri, 7 Jan 2005, Mark Kels wrote: > > > I started to read the following code (I will start working on it when > > this problem is fixed) and it looks OK while I read it. But

[Tutor] Python with MySQL ?

2005-01-11 Thread Mark Kels
Hi all. How can I send SQL querys to a MySQL database with a python-CGI program ? Thanks. -- 1. The day Microsoft makes something that doesn't suck is probably the day they start making vacuum cleaners. 2. Unix is user friendly - it's just picky about it's friends. 3. Documentation is like sex: w

[Tutor] Python and IRC

2005-01-19 Thread Mark Kels
Hi all, I want to make an IRC bot with python... The problem is that I cant find any good information about this topic (not even documentation for the irclib module). Does anyone here have some experience with python programming for IRC (clients, bots, etc) and can give me some simple source code

[Tutor] Test

2005-02-01 Thread Mark Brown
Test, please disregard. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Tkinter questions

2005-02-01 Thread Mark Kels
Hello, I got some Tkinter questions that I need the answer for to complete a little project of mine: 1. How can I make the program to open in a X*Y sized window ? 2. How can I open another window from the first one (without closing it) ? 3. How can I add a file browser for my app (like the one you

[Tutor] A problem with a Tkinter program (using the text widget)

2005-02-05 Thread Mark Kels
Hi all. Whats wrong here ?? : from Tkinter import * def p_text(): print text.get() root=Tk() text=Text(root).pack() button=Button(root,text="Click here!!",command=p_text).pack() root.mainloop() I get an error that says that nontype object has no attribute 'get'... whats wrong ?? Thanks. --

[Tutor] The Tkinter Text widget and .get()

2005-02-06 Thread Mark Kels
Hi all. As I understand, .get() has to get an index argument to get the text from the Text index... The problem is that I dont realy understand what is this index thing and what index do I need to give to the function so I'll get all the text in the widget. Any ideas ?? Thanks ! -- 1. The day M

[Tutor] Negative IF conditions

2005-02-11 Thread Mark Brown
Hi, I'm a newbie and was wondering which of these IF conditions is better structure: if not os.path.exists('filename'): if os.path.exists('filename') == False: They both work so if one preferred over the other? Thanks Mark Brown

[Tutor] Downloading from http

2005-02-12 Thread Mark Kels
Hi list. How can I download a file from an HTTP server ? I checked the documentation but couldn't find what I need. Thanks! -- 1. The day Microsoft makes something that doesn't suck is probably the day they start making vacuum cleaners. 2. Unix is user friendly - it's just picky about it's frien

Re: [Tutor] Downloading from http

2005-02-12 Thread Mark Kels
On Sat, 12 Feb 2005 09:25:10 -0500, Jacob S. <[EMAIL PROTECTED]> wrote: > urllib or urllib2 or maybe httplib maybe? > > urlopen( url[, data]) > > Open the URL url, which can be either a string or a Request object. > data should be a string, which specifies additional data to send to t

Re: [Tutor] cross platform gui

2005-02-13 Thread Mark Kels
On Sun, 13 Feb 2005 08:03:45 -0800, Lobster <[EMAIL PROTECTED]> wrote: > > Hi all, > > i'm interested in building a gui for some code we have. I'm after > pointers on gui programming, and a recommendation on a cross platform > gui library, wxpython? pythoncard, qt? What do people use. Ideally i'

[Tutor] Help with error handling in a while loop

2005-02-18 Thread Mark Kels
Hi all. I'm trying to build a simple port scanner (just to learn sockets). here is the code (doesn't work) : import socket sk=socket.socket(socket.AF_INET, socket.SOCK_STREAM) host=raw_input("Enter name of host to scan: ") start_port=input("Enter the start port: ") end_port=input("Enter the end por

[Tutor] help with .get in Tkinter

2005-02-20 Thread Mark Kels
Hi all. First, here is the code I have a problem with (I got same problem in my project) : from Tkinter import * def go(): e.get() print e main=Tk() e=Entry(main) e.pack() b=Button(main,text='OK',command=go()).pack() main.mainloop() For some reason the function is called before I click th

[Tutor] Help debuging a small program

2005-02-21 Thread Mark Kels
Hi list ! Here is a small port scanner I made to practice sockets and GUI programming ( WARNING: the program crash when scan button is clicked): #--Imports-- from Tkinter import * import socket #--The result GUI window function- def result(): global result_t #I

Re: [Tutor] Help debuging a small program

2005-02-22 Thread Mark Kels
On Mon, 21 Feb 2005 13:21:35 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > How far does it get? How do you know? > > I would put some debug print statements in. Also you should call sk.close() > in the else clause of > scan(). Finally, I don't think you will see any output in the result window

[Tutor] 3 questions for my port scanner project

2005-02-26 Thread Mark Kels
Hi list. Here are the questions (-: 1. How do I make a progress bar in Tkinter ? 2. I got a while loop which does the port scan itself. How can I end it while its working ? 3. For some reason the scan is too slow (2-3 seconds for a port). Is there a way to make it faster (other port scanner work a

Re: [Tutor] 3 questions for my port scanner project

2005-02-27 Thread Mark Kels
On Sun, 27 Feb 2005 03:24:07 -0800 (PST), Shitiz Bansal <[EMAIL PROTECTED]> wrote: > > The ports which do not respond are the ones which take > most of the time.You can use the timer object to fix > the time for each port.For eg. if a port does not > respond within .1 sec it can reasonably be expe

Re: [Tutor] 3 questions for my port scanner project

2005-02-27 Thread Mark Kels
On Sun, 27 Feb 2005 16:00:12 -, Alan Gauld <[EMAIL PROTECTED]> wrote: > One option: > Use a set up gif images and update the image periodically > OR > Use a canvas and redraw a rectangle slightly larger every > time through the scanning loop. Thats think this is the easy part... The hard part

[Tutor] How to use threads ?

2005-03-01 Thread Mark Kels
Can anyone give me a very simple example on thread programming ? I looked at some tutorials but they don't really make sense... Thanks in advance -- 1. The day Microsoft makes something that doesn't suck is probably the day they start making vacuum cleaners. 2. Unix is user friendly - it's just

Re: [Tutor] How to use threads ?

2005-03-02 Thread Mark Kels
On Tue, 1 Mar 2005 12:25:37 -0800 (PST), Shitiz Bansal <[EMAIL PROTECTED]> wrote: > > Here is a simple program > > class abc(threading.Thread): > def __init__(self): > threading.Thread.__init__(self) > self.x=1 etc. etc. > self.cont_flag=1 > def run(self): >

Re: [Tutor] How to use threads ?

2005-03-03 Thread Mark Kels
On Wed, 2 Mar 2005 14:48:11 -0800 (PST), Shitiz Bansal <[EMAIL PROTECTED]> wrote: > The thread finishes when: > 1.The run method finishes. > 2.In case of the loop- you may - > > >>> import threading > >>> class abc(threading.Thread): > def __init__(self): > threading.Thread

Re: [Tutor] How to use threads ?

2005-03-03 Thread Mark Kels
On Thu, 3 Mar 2005 14:31:55 +, Gwyn Evans <[EMAIL PROTECTED]> wrote: > Hi, > The one thing that stands out is that when you subclass Thread as > you do, you need to override the 'run' method, which will get called > as a result of you calling 'start()'. > You're calling start(), but you've

Re: [Tutor] How to use threads ?

2005-03-03 Thread Mark Kels
On Thu, 3 Mar 2005 16:36:05 +, Gwyn Evans <[EMAIL PROTECTED]> wrote: > How are you trying to start another scan? You'd have to create a > new instance, you can't just call app.start() again. Thanks allot !! This is exactly what I was doing wrong. Now it works :) -- 1. The day Microsoft ma

[Tutor] Whats so good about OOP ?

2005-03-12 Thread Mark Kels
Hi list ! I want to know whats so great in OOP... I have learned some of it, but I don't understand why everybody like it so much... Can anyone give me an example for a task that could be done only with OOP or will be much simpler to do with it ? Thanks in advance. -- 1. The day Microsoft makes

[Tutor] Unreadable code explanation

2005-03-17 Thread Mark Kels
Hi list. I have downloaded some code from useless python that was writen buy a guy named Sammy Mannaert. The code should show that python can be unreadable, and it really is... Can anyone explain to me how does this thing works ?? Here is the code (it prints "python readable ?"): f=lambda x="8<:47

[Tutor] Cryptography Toolkit

2005-03-31 Thread Mark Thomas
Does anyone have some examples on the use of A.M. Kuchling's Python Cryptography Toolkit? I've tried his examples but get "AttributeError" and "TypeError". What I'm trying to do is encrypt/decrypt a file. I'm using Python 2.3 on xp pro. Thanks -- _ ( )

Re: [Tutor] Cryptography Toolkit

2005-03-31 Thread Mark Thomas
t;bhxupds&oo`g'uou`z`" <== *confused by this output* Close but no cigar!! *grin* -- _ ( ) Mark Thomas ASCII ribbon campaign X www.theswamp.org - against HTML email / \ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Cryptography Toolkit

2005-04-01 Thread Mark Thomas
ncrypt > > xored = obj_xor.encrypt(str_encrypt) > print xored > > obj_xor = XOR.new("string") > print obj_xor.decrypt(xored) > > Kent Excellent !! Many thanks Kent. -- _ ( ) Mark Thomas ASCII ribbon campaign X www.theswamp.org - against HTML email / \ ___

[Tutor] Python and ICQ??

2005-04-28 Thread Mark Kels
Hi list ! Does anyone here knows of a way to connect to ICQ with Python? Thanks in advance. -- 1. The day Microsoft makes something that doesn't suck is probably the day they start making vacuum cleaners. 2. Unix is user friendly - it's just picky about it's friends. 3. Documentation is like sex:

Re: [Tutor] Python and ICQ??

2005-04-29 Thread Mark Kels
On 4/29/05, tanja pislar <[EMAIL PROTECTED]> wrote: > try pyICQ-t, (it's an ICQ transport for jabber implemented in python) > http://pyicq-t.blathersource.org/ > > regards, > tanja Thanks, but its to complicated for my needs. What I need is a simple module that will allow me to connect to ICQ and

[Tutor] Web Calendar written in Python

2005-05-04 Thread Mark Brown
Does anyone know of a Web Calendar written in Python? TIA Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Simple string processing problem

2005-05-13 Thread Mark Thomas
GAAATTGCAAATTAACTGTG ScerACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAA SparACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAA SmikACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAA SbayACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAA -- _ ( ) Mark Thomas ASCII ribb

[Tutor] Program to lock folders under win32

2005-05-26 Thread Mark Kels
Hi list. I want to make a program to lock folders (so the user can only access them if he knows the password) under win32, the only problem is that I have no idea how to start or what to do. Do you guys have any ideas of how to do it? Thanks! -- 1. The day Microsoft makes something that doesn'

Re: [Tutor] (no subject)

2005-07-06 Thread Mark Thomas
On 7/6/05, Michael Huster <[EMAIL PROTECTED]> wrote: > In python under windows, how can I create and access a file on the Desktop? > The following do NOT work: How about... >>> userp = os.getenv('USERPROFILE') + '\\Desktop\\MyFile.txt' >>> fo =

[Tutor] Virtual keyboard

2005-07-14 Thread Mark Kels
Hi list. I want to make a virtual keyboard with Tkinter. Can I have some pointers on how to do it? Will it be hard (it doesn't look so hard...)? Thanks. -- 1. The day Microsoft makes something that doesn't suck is probably the day they start making vacuum cleaners. 2. Unix is user friendly - i

Re: [Tutor] Virtual keyboard

2005-07-14 Thread Mark Kels
On 7/14/05, luke <[EMAIL PROTECTED]> wrote: > I don't think it will be hard, but it depends what you want to pass > keypresses to. > If you want your virtual keyboard to type in any program you will have to > deal with > focus issues and it seems to me that would be hard, if possible. > but if you

Re: [Tutor] Virtual keyboard

2005-07-14 Thread Mark Kels
On 7/14/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > You would need some way of getting a handle for the widget you want to type > into.. I don't know how to do this (or even if you can), but I wonder if you > might have more luck if you used PythonWin and the Microsoft factory classes > to

[Tutor] python links

2007-12-16 Thread Mark Alexiuk
some variant and what libraries people find useful, such as UnitTest and Logging. What follows are some links and excerpts I found looking for information on this topic. Cheers, Mark === *Open Embedded* OpenEmbedded is a tool which allows developers to cre

Re: [Tutor] How to strip both single and double quotes

2005-10-05 Thread Mark Thomas
\" \' ()*&^%$# << ' >>> [x.strip('\' \" () * & ^ % $ # < ') for x in str.split()] ['this', 'has', 'special', 'characters', '', '', '', ''] -- _ ( ) Mark Thomas ASCII ribbon campaign X www.theswamp.org - against HTML email / \ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Can anyone help me?

2005-10-28 Thread Mark Brown
nge(6): while True: draw = random.choice(range(1,50)) if not(numbers.count(draw)): numbers.append(draw) break print numbers elif q == '2': break else: print "Read the in

Re: [Tutor] New Tutorial topic available

2006-02-26 Thread Mark Thomas
ormation for us newbies. -- _ ( ) Mark Thomas ASCII ribbon campaign X www.theswamp.org - against HTML email / \ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Some help with properties and accessor functions....

2006-04-19 Thread Mark True
entirely what I am doingcan someone help? I don't really understand what setting properties does and how I access the defined get/set functions in this object. Any info would be wonderful, thanks in advance!--Mark ___ Tutor maillist -

Re: [Tutor] Starting python from a DOS prompt from any directory?

2007-01-02 Thread Mark Wilkinson
I think this will answer your question: http://www.python.org/doc/faq/windows.html#how-do-i-run-a-python-program -under-windows Mark This email and any attachment may contain confidential, privileged information for the sole use of the intended recipient. If you are not the intended

Re: [Tutor] Best IDE for Python

2007-01-26 Thread Mark Thomas
On 1/26/07, OkaMthembo <[EMAIL PROTECTED]> wrote: > how useable is vim on Windows? Very! I've used Vim on Windows since the 5.3 version, it only gets better. Like Alan said there is a learning curve, but once you've "got it" there is no going back. > i wish i could learn Unix. which distro do you

[Tutor] Convert my .bat and .vbs to .py

2007-02-15 Thread Mark Bystry
lustration" pdf files to certain folders than deletes the left over pdf files when done. Yes, I could move them instead of copying them. I'm no asking for anyone to write this for me but if someone could lead me i the right direction, I would be gr

Re: [Tutor] Convert my .bat and .vbs to .py

2007-02-15 Thread Mark Bystry
Wow! Got a lot of responses to my post. Thanks everyone. After reading all of them, I may have to learn by example after all. I'm going to try Alan Gauld's tutorials first. Mark Alan Gauld wrote the following on 2/15/2007 12:39 PM: > "Mark Bystry" <[EMAIL PROTECTED]&

Re: [Tutor] Convert my .bat and .vbs to .py

2007-02-15 Thread Mark Bystry
You guys are great! I'm not sure how I found this mailing list but I'm glad that I subscribed. Mark Rob Andrews wrote the following on 2/15/2007 1:23 PM: > We're good like that. heh > > On 2/15/07, Mark Bystry <[EMAIL PROTECTED]> wrote: >> Wow! Got a

Re: [Tutor] Convert my .bat and .vbs to .py

2007-02-15 Thread Mark Bystry
Well, immediately I am having problems. Be patient with me. This what I have... copy_file.py import os import shutil as sh sh.copy('C:\testing_it.txt', 'D:\') raw_input("Done!") ...and it's not working.

Re: [Tutor] Convert my .bat and .vbs to .py

2007-02-15 Thread Mark Bystry
Jeez! I'm retarded. It works like a charm now. Thanks for that Rob Mark Rob Andrews wrote the following on 2/15/2007 2:29 PM: > Ahh, yes. Your main trouble seems to be the use of \ instead of / in > 'C:\testing_it.txt' > > Windows uses \, whereas python us

Re: [Tutor] Convert my .bat and .vbs to .py

2007-02-15 Thread Mark Bystry
Ahh. Great tip Eric. Thank-you. Mark Eric Walstad wrote the following on 2/15/2007 2:58 PM: > Hey Mark, > Mark Bystry wrote: >> sh.copy('C:\testing_it.txt', 'D:\') > > Also have a look at the os.path module. Because you want these scripts > to work

Re: [Tutor] New Tutor topic(almost)

2007-02-16 Thread Mark Bystry
ith my checkbook. Hoping to pick up some pyhton for complete n00bs reading) Keep up the great work, Alan. Mark Alan Gauld wrote the following on 2/16/2007 4:45 AM: > "Alan Gauld" <[EMAIL PROTECTED]> wrote in > >> After a very long delay I finally got some wo

Re: [Tutor] New Tutor topic(almost)

2007-02-16 Thread Mark Bystry
I'll look for it. Perhaps I should pick up one of the "Dummies" book too. Mark Kent Johnson wrote the following on 2/16/2007 8:35 AM: > Mark Bystry wrote: >> Well, I'm new here and for the most I haven't got a clue as to what I'm >> doing, however,

[Tutor] Add metadata to a dir of files.

2007-02-22 Thread Mark Bystry
. Can someone provide sample code that maybe I could expand upon or point to a link somewhere so I can read up on the subject? I would appreciate it. Thank-you, Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Mark Bystry
obviously affects all files giving them all the same attribute. I can continue doing it this way but I thought perhaps a script would be best. Maybe it isn't, I don't know. Anyway, thank-you for the links. Mark Tim Golden wrote the following on 2/22/2007 12:28 PM: >> H

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Mark Bystry
help of dsofile.dll the above reads the "Category" attribute of test.txt. Mark Bystry wrote the following on 2/22/2007 1:01 PM: > Actually no. I want to change the Windows metadata. This is the same metadata > that is on all files. > It isn't PDF specific. (I wonder if Lin

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Mark Bystry
getting even closer. figure out how to write to a file but still in vbscript. dsofile_write.vbs code: Set objFile = CreateObject("DSOFile.OleDocumentProperties") objFile.Open("D:\test.txt") objFile.SummaryProperties.Category = "CAT54" objFile.Save Mark Mark Byst

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Mark Bystry
1), None) code: import win32com.client props = win32com.client.Dispatch ("DSOFile.OleDocumentProperties") props.Open (r"C:\test.txt") props.SummaryProperties.Category = "CAT69" props.Save () Maybe this is the same com error that you're getting Mark Tim Golde

Re: [Tutor] Add metadata to a dir of files.

2007-02-23 Thread Mark Bystry
python basics but I'm no programmer. Thanks everyone for your help. Mark. Tim Golden wrote the following on 2/22/2007 4:06 PM: > Tim Golden wrote: >> Slightly bizarrely, it works fine for me on a different >> computer (my laptop). Both are Win2K. The only help I >> could

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

2008-04-27 Thread Mark Tolonen
erver): filenumber = 1 class MyThread(threading.Thread): def run(self): listen= server = MyServer(('',listen),MyHandler) server.serve_forever() t=MyThread() t.setDaemon(True) t.start() --Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tutorial indicating different output

2008-05-08 Thread Mark Tolonen
nce. Anyone know why? http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

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

2008-05-12 Thread Mark Tolonen
simple DLL functions that take integers and return integers. If your APIs deal with pointers and read/write buffers it is somewhat more complicated, but still easier to write your bindings in Python than using the Python C APIs. -Mark ___ Tutor mai

[Tutor] ooffice UNO to generate automatic powerpoint presentations

2008-06-13 Thread Mark Alexiuk
would add title, text, and images. Has anyone done this with openoffice UNO? Thanks for your comments, Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Newbie: Sorting lists of lists

2008-06-19 Thread Mark Tolonen
sorted(L,key=lambda x: (x[1],x[2])) [[3, 2, 1], [1, 2, 3], [2, 3, 1], [1, 3, 2]] -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] For Loop question

2008-06-26 Thread Mark Tolonen
and later) or should use xrange instead of range (on Python 2.5 or earlier, especially for large lists). Another option is: myList = [1,2,3,4] for index,value in enumerate(myList): myList[index] = value + 1 -Mark ___ Tutor maillist - Tutor@python.or

Re: [Tutor] need help with a regular expression

2008-06-28 Thread Mark Tolonen
.compile(r'^_{0,3}[A-Z](?:[A-Z0-9]|-(?!-))*(?single-letter strings are allowed -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] arrays in python

2008-06-28 Thread Mark Tolonen
;> L [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]] >>> L[0][0]=1 >>> L [[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]] Use a list comprehension to construct five different lists. --Ma

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

2008-06-29 Thread Mark Tolonen
; until print displays the correct filenames :^) Also, "list" and "file" are Python built-ins, so avoid using those names in code. import os,fnmatch patterns = '*.ini *.db'.split() for root,dirs,files in os.walk('/home/saad'): for pattern in patterns:

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

2008-07-03 Thread Mark Tolonen
.fibsseq = [0, 1] def __getitem__(self, key): for i in xrange(key - len(self.fibsseq) + 1): self.fibsseq.append(self.fibsseq[-1] + self.fibsseq[-2]) return self.fibsseq[key] -Mark "Emil" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hey

Re: [Tutor] manipulating a string

2008-07-15 Thread Mark Tolonen
re D_H = 'D 5 10 15 20 25 30 35 40 D Upper D Lower' print re.split(r'\s(?![UL])',D_H) # split on spaces not followed by U or L. ['D', '5', '10', '15', '20', '25', '30', '35', '40', &#x

Re: [Tutor] Unittest

2008-07-16 Thread Mark Tolonen
with an editor that can display utf-8 (such as Notepad on Windows). python testfile.py 2>error.txt # this redirects stderr to a file. Hope that helps, Mark "Oleg Oltar" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] The code # -*- codi

Re: [Tutor] Unittest

2008-07-16 Thread Mark Tolonen
nal that display those characters? Can you change your terminals encoding preference via an environment variable? -- Mark "Oleg Oltar" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] And in case: # coding: utf-8 import traceback try: r

Re: [Tutor] Unittest

2008-07-17 Thread Mark Tolonen
You get the "D" characters when decoding Russian encoded in UTF-8 using Latin-1 instead. # coding: utf-8 x=u'Зарегистрироваться' print x.encode('utf-8').decode('latin-1') Зарегистрироваться Check that your html encoding is declared corr

Re: [Tutor] Raw string

2008-07-21 Thread Mark Tolonen
tual characters in the file end up in the string. No backslash interpretation is performed. So in your example, just read in the file and perform your operations: sample.txt contains: c:\abc\123.txt Code: >>> import os >>> pathname = open('sample.txt').read() >>> pathname 'c:\\abc\\123.txt' >>> print pathname c:\abc\123.txt >>> print os.path.dirname(pathname) c:\abc >>> print os.path.basename(pathname) 123.txt >>> os.path.dirname(pathname) 'c:\\abc' >>> os.path.basename(pathname) '123.txt' Does that clear up the confusion? --Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] print the hole unicode list

2008-08-28 Thread Mark Tolonen
7;,encoding='utf-8') for i in xrange(32,0x1): # skip control chars if i < 0xD800 or i > 0xDFFF: # skip surrogate pair chars f.write(u'%04X: %s\t' % (i,unichr(i))) f.close() -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Downloading Files from the net

2008-09-28 Thread Mark Tolonen
ck and dirty, if example.mp3 isn't too big to fit in memory at once: import urllib fin = urllib.urlopen('http://www.example.com/example.mp3') fout = open('example.mp3','wb') fout.write(fin.read()) fin.close() fout.close() -Mark

Re: [Tutor] python regex help

2008-09-28 Thread Mark Tolonen
r'(?ms)Contact Candidate\s*\n(.*?) -.*?\nTel: (\d+)') print record.findall(data) --cut Output: [('Jyoti Soni', '09975610476'), ('Minal', '9890498376')] -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Edit a Word document programmatically

2008-10-14 Thread Mark Tolonen
rFormatting() >>> find.Replacement.ClearFormatting() >>> find.Text = 'fox' >>> find.Replacement.Text = 'cat' >>> find.Forward = True >>> find.Wrap = win32com.client.constants.wdFindContinue >>> find.Execute(Replace=win32co

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

2008-10-21 Thread Mark Tolonen
f16') adds a BOM every time, and the space wasn't encoded. utf-16-le and utf-16-be don't add the BOM. This works: import codecs s = u"The cat sat on the mat" f = codecs.open("utf16.txt","wb","utf-16-le") f.write(u'\ufeff') # if yo

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

Re: [Tutor] extend my re

2008-11-22 Thread Mark Tolonen
that works for your example: MyPattern = re.compile(r'(.*?Start.*?)((\n\s*comment.*?)*\n)(\s*comment.*?)(\n.*?end)', re.S) You might look into something like pyparsing instead of a complicated re. -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] accessing list from a string

2008-11-25 Thread Mark Tolonen
x1,x2=Positions I know this does not work. Is there a direct way to get my x1 and x2 values. line = '[2.5,2.8]' x1,x2 = eval(line) x1,x2 (2.5, 2.7998) -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Working with lists

2008-12-13 Thread Mark Tolonen
. yield L[i:i+n] ... for n in shift(L,2): ... print n ... [1, 2] [2, 3] [3, 4] [4, 5] [5, 6] for a,b,c in shift(L,3): ... print a,b,c ... 1 2 3 2 3 4 3 4 5 4 5 6 [sum(n) for n in ishift(L,2)] [3, 5, 7, 9, 11] [sum(n) for n in ishift(L,3)] [6, 9, 12, 15] -Mark

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

2008-12-16 Thread Mark Tolonen
g var? Thanks, Basu mod = __import__(var) -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] to sort

2008-12-25 Thread Mark Tolonen
b [12, 21, 35, 47, 56, 94] -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

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

2009-01-03 Thread Mark Tolonen
E and PATTERN are first case-normalized if the operating system requires it. If you don't want this, use fnmatchcase(FILENAME, PATTERN). -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Deleting recursive folder definition

2009-01-12 Thread Mark Tolonen
oints, which are the entities that underlie junction points c.. Aimed primarily at developers who create reparse points d.. Location: Microsoft Windows 2000 Resource Kit Linkd or Delrp sound like what you may need. If you want to fix the problem programmatically, try looking up: DeviceIoControl FSC

Re: [Tutor] Date comparison across time zones

2009-01-13 Thread Mark Tolonen
lly). The dates all have the following RFC2822 format: Eg. is d1 < d2? d1 = "Tue, 13 Jan 2009 03:27:29 -0800" d2 = "Tue, 13 Jan 2009 02:40:00 -0600" Check out the email.utils module, specifically the parsedate_tz and mktime_tz functions. -Mark

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

Re: [Tutor] dict() versus {}

2009-01-21 Thread Mark Tolonen
given how this works: >>> def function(**kwargs): ... print kwargs ... >>> function(one=1,two=2,three=3) {'three': 3, 'two': 2, 'one': 1} One can guess how the shortcut is implemented. -Mark "wormwood_3" wrote in message news:4543

Re: [Tutor] wx accelerator table: one keystroke seems skipped

2011-01-06 Thread Mark Weil
Ctrl+M isn't bound to anything in particular in wxPython (the 'enter' key or otherwise). Drop down menus will auto-bind menu items if you include the shortcut keys on the menu's line item; Ctrl+N for New, for example. The OS could also be catching the event and doing something unwanted. Ctrl+M wo

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

2011-02-11 Thread Mark Tolonen
7;|', the following code will produce the same result in openPOs: import csv with open('open_pos.txt','rb') as f: reader = csv.reader(f,delimiter='|') openPOs = list(reader) print openPOs Note you may have to specify some more paramet

Re: [Tutor] having difficulty installing python

2011-02-24 Thread Mark Weil
Is there a reason you don't want to use the newer, already pre-installed version? http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/python.1.html ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscrip

Re: [Tutor] wxPython parent classes

2011-04-19 Thread Mark Weil
wx.Panel provides better cross-platform reliability, so it's fairly standard practice to go with a Panel in a Frame, and place the buttons, etc. on the panel. On Tue, Apr 19, 2011 at 11:59 AM, Eric Stevens wrote: > I've been noticing that in all the example codes I have seen, when someone > cre

Re: [Tutor] python ctypes dll issue

2011-05-09 Thread Mark Tolonen
Assertion Failed! Program: C:\Python27\pythonw.exe file: fread.c line: 93 Expression: (buffer != NULL) Whats the problem? Any idea? "windll" requires the function called to be __stdcall calling convention. The default is normally __cdecl. Try "cdll" instead. -Mark __

<    1   2   3   4   5   6   7   8   9   10   >