[Tutor] Pyflakes pre-commit hook in subversion

2008-01-08 Thread Mark
http://tarekziade.wordpress.com/2006/11/01/protecting-a-python-svn-code-base-with-the-pre-commit-hook/ Is it possible to check code in python before committing to svn   using pyflakes, pythontidy Pyflakes and Subversion Pyflakes is a nice little utility that checks your Python code for err

[Tutor] Traversing python datatypes via http

2008-02-05 Thread Mark
Is it possible to traverse say python lists via http:// say there is a list in the memory can we traverse the list using list/next list/prev list/first list/last is there a pythonic library to do that? thanks ___ Tutor maillist - Tutor@python.org h

[Tutor] Help with class.self variables

2008-05-14 Thread Mark
im trying to create a class user so that i can do r=User(1) r._user.keys() ['rating', 'last_name', 'pageviews', 'ip', 'number_polls', 'site', 'myrand', 'hotmail', 'number_activities', 'skype', 'id', 'city', 'rawpassword', 'number_useraudios', 'zip', 'number_votes', 'last_login', 'number_u

[Tutor] Broblem with exiting a Tkinter app

2004-12-04 Thread Mark Kels
Hi all , I got 2 questions for you guys. The fist question: I wrote small Tkinter app while laerning about the Radiobutton widget, and I added a "Quit" button, like this: bb=Button(root, text="Quit", fg="BLUE", command=root.quit).pack() When I pressed the button the app crashed and I got an error

Re: [Tutor] Broblem with exiting a Tkinter app

2004-12-04 Thread Mark Kels
On Sat, 04 Dec 2004 14:38:06 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > Mark Kels wrote: > > > > Hi all , > > I got 2 questions for you guys. > > > > The fist question: > > I wrote small Tkinter app while laerning about the Radiobutton widge

[Tutor] How to get input from Tkinter app ?

2004-12-10 Thread Mark Kels
Hi all, I got 2 questions: 1. How to get input from Tkinter widgets like Text, Entry, Checkbutton, Scale etc (almost any widget that isn't a button) ? for some reason its not explained clearly in any tutor I looked in... 2. How to print text using python ( through the printer ) ? __

[Tutor] Tkinter questions

2004-12-17 Thread Mark Kels
Hi all , I got some Tkinter related questions for a project that I'm making: 1. How to add an image to a button ? 2. How can I print text using Tkinter (I want it to be cross platform, so I cant use modules like win32print ) ? 3. How to I make the program to always open in a full window ? Thanks a

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

2010-01-19 Thread Mark Tolonen
on but the function i want to call is part of a cpp class in my dll... ctypes is for C DLLs. You might want to look at www.swig.org instead. -Mark ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.

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

2010-01-19 Thread Mark Tolonen
rent changes in the same file. Sounds like the record and crecord extensions come close, anyway: http://mercurial.selenic.com/wiki/RecordExtension http://mercurial.selenic.com/wiki/CrecordExtension TortoiseHg's commit GUI allows this. -Mark __

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 ___ Tuto

[Tutor] Defining operators for custom types

2010-02-12 Thread Mark Young
I created a custom vector type, inheriting from object, and defined __mul__, __add__, etc. Unfortunately, the operators only work if I type "vector * (int/float/number)", in that exact order. My program produces an error if I instead type "number * vector". This makes sense to me, because I haven't

Re: [Tutor] Defining operators for custom types

2010-02-12 Thread Mark Young
Thanks for the help. That's exactly the kind of solution I wanted. I've been to that page several times already, but just ignored that section apparently. Thanks alot. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] Python 3.0

2010-02-20 Thread Mark Tolonen
.getch() returns 255 immediately. Windows applications without a console usually don't play nice with C I/O calls. -Mark ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to wrap ctype functions

2010-03-05 Thread Mark Tolonen
f something(a,b): ... print a,b ... something(1,2) doing prep work... 1 2 -Mark ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Encoding

2010-03-05 Thread Mark Tolonen
string. The coding line isn't even used. The bytes will be exactly what was saved in the file between the quotes. -Mark ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Movement controls useing pygame

2010-03-19 Thread mark-ireland
winCenterx and charRect['rect'].centerx < jumpRect.centerx: charRect['dir'] = DOWN I've included the whole code as a note pad so the above makes more sense, don't worry about all the comments, that's just for my convenience. Thanks guys Mark '

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

2010-04-01 Thread Mark Tolonen
. Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for further copyright information. s = "Sun Jan 23 14:28:32 1965" from datetime import datetime d=datetime.strptime(s,'%a %b %d %H:%M:%S %Y') d.hour 14 d.minute 28 d.second 32 d.time() da

Re: [Tutor] Sequences of letter

2010-04-11 Thread Mark Tolonen
use my computer no memory left -- ¡Saludos! / Greetings! Juan José Del Toro M. jdeltoro1...@gmail.com Guadalajara, Jalisco MEXICO ___ Tutor maillist - Tutor@python.org To un

Re: [Tutor] Python 2.5.4 - error in rounding

2010-05-21 Thread Mark Tolonen
down to 0.47 .485 0.48499 # %.2f will round down to 0.48 round(.475,2) 0.47998 # %.2f will round up to 0.48 round(.485,2) 0.48999 # %.2f will round up to 0.49 -Mark ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] class methods: using class vars as args?

2010-05-27 Thread Mark Lawrence
d some explanations as to what happens, but what are you trying to achieve? Why don't you forget about arg3 because it is arg1, which must exist by creating an instance of class c, or you wouldn't be able to call doSomething in the first place? HTH. Mark Lawrence _

Re: [Tutor] list of dicts <-> dict of lists?

2010-05-27 Thread Mark Lawrence
I confess that I don't like top posting :) Please see below. On 28/05/2010 00:19, Matthew Wood wrote: #!/usr/bin/env python Here's my best attempt. I'm not sure if it's "simpler" than yours, but for me it seems a bit cleaner. Then again, I LOVE the zip operator, and the '*' operator too. :

Re: [Tutor] class methods as static methods?

2010-05-29 Thread Mark Lawrence
) I think that you're trying to build a Yamoto/Musashi before you've built a raft from oil drums or whatever :) If I'm wrong, I'll apologise here and now. For a really great introduction to Python, I suggest diveintopython, it's what got me going eight years ago

Re: [Tutor] class methods as static methods?

2010-05-29 Thread Mark Lawrence
Hi Alex, thanks for the response, please see below. On 30/05/2010 02:50, Alex Hall wrote: On 5/29/10, Mark Lawrence wrote: On 29/05/2010 20:49, Alex Hall wrote: Hi all, In Battleship, I have a weapons.py file, currently with just one missile type (a Harpoon anti-ship missile). This Harpoon

Re: [Tutor] matmolplot

2010-06-01 Thread Mark Lawrence
lem is the call to plt.axis which sets xmin to 350, compare this to your data values where the lowest value of x is 233.27. Note that there is also a matplotlib mailing list. HTH. Mark Lawrence. ___ Tutor maillist - Tutor@python.org To unsubscri

Re: [Tutor] while loops causing python.exe to crash on windows

2010-06-07 Thread Mark Lawrence
On 07/06/2010 01:44, Alex Hall wrote: Further to the other comments that you've had, could you please refer to the following, thanks. http://www.catb.org/~esr/faqs/smart-questions.html Kindest regards. Mark Lawrence ___ Tutor maillist -

Re: [Tutor] a class query

2010-06-07 Thread Mark Lawrence
, Malcolm ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor RTFM? :) Kindest regards. Mark Lawrence. ___ Tutor maillist - Tutor

Re: [Tutor] a class query

2010-06-07 Thread Mark Lawrence
On 07/06/2010 17:03, pyt...@bdurham.com wrote: Hi Mark, I was surprised to see class Name() work (in Python 2.6.5 at least). Is this equivalent to class Name( object ) or does this create an old style class? Going forward into the 2.7/3.x world, is there a preferred style? RTFM? :) I am

Re: [Tutor] a class query

2010-06-07 Thread Mark Lawrence
On 07/06/2010 17:30, pyt...@bdurham.com wrote: Hi Mark, I see that Stephen D'Aprano has already replied twice so I won't bother. Apart from that no offence meant, I hope none taken. Your RTFM reply actually gave me a good laugh. No (zero) offence taken. And I appreciate your ma

Re: [Tutor] Problems with Importing into the Python Shell

2010-06-12 Thread Mark Lawrence
^ SyntaxError: invalid syntax The chap03.py file is a simple one that looks like this: def print_twice(param): print param param One of the great advantages of Python is trying things from an interactive prompt, so let's go. c:\Users\Mark\python>python Python 2.6.5 (r26

Re: [Tutor] How to model objects aimed to persistence?

2010-06-16 Thread Mark Lawrence
.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor Hi Jan, I guess you're looking for something like the shelve or pickle modules. http://docs.python.org/library/shelve.html http://docs.python.org/library/pickle.html HTH. Mark Lawrence.

Re: [Tutor] help

2010-06-17 Thread Mark Lawrence
someone, help. I'll leave you to find out the rests of the lyrics. :) Mark Lawrence. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] help

2010-06-17 Thread Mark Lawrence
On 17/06/2010 19:22, Lowell Tackett wrote: From the virtual desk of Lowell Tackett --- On Thu, 6/17/10, Mark Lawrence wrote: From: Mark Lawrence Subject: Re: [Tutor] help To: tutor@python.org Date: Thursday, June 17, 2010, 8:30 AM On 17/06/2010 08:28, KB SU wrote: help Help, I need

Re: [Tutor] Question

2010-06-19 Thread Mark Lawrence
, Python and C++. Obviously I am working on learning python right now, I have gotten up to Classes(I am studying from Learning Python 3rd and 4th editions from Mark Lutz on Safari online books), and feel like I have a pretty good idea of everything before classes. Yea there are still a lot of

Re: [Tutor] re.sub() query

2010-06-20 Thread Mark Lawrence
h warm regards, -Payal You can do this. >>> re.sub('[lL]','-',a) 'Mary Had a -itt-e -amb' However it strikes me as overkill to use an re for something that could be done with the string replace function. Kindest regards. Mark Lawrence. ___

[Tutor] Calling a number's methods

2010-06-22 Thread Mark Young
Why does this work >>> a = 6 >>> b = 7 >>> answer = a.__sub__(b.__neg__()) >>> answer 13 but this does not? >>> answer = 6.__sub__(7.__neg__()) SyntaxError: invalid syntax I searched the internet, and found someone suggest adding spaces after each number, which indeed works properly. >>> answ

Re: [Tutor] Calling a number's methods

2010-06-23 Thread Mark Young
Hmm, apparently python doesn't care about whitespace in method calls or attribute access: class person: def __init__(self): self.name ="jim" def hi(self): print("hello") >>> guy = person() >>> guy. name 'jim' >>> guy .hi() hello That at least explains that par

Re: [Tutor] retrieve URLs and text from web pages

2010-06-29 Thread Mark Lawrence
On 29/06/2010 17:32, Joel Goldstick wrote: [big snips] It might not be completely relevant, but there is nothing to stop anybody mixing regex and/or string methods. Horses for courses? Kindest regards. Mark Lawrence. ___ Tutor maillist - Tutor

Re: [Tutor] puzzled by Python 3's print()

2010-07-01 Thread Mark Lawrence
r@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor Take a look at section 7.1.3 here. http://docs.python.org/py3k/library/string.html#string-formatting This is the recommended way to format str

Re: [Tutor] puzzled by Python 3's print()

2010-07-01 Thread Mark Lawrence
hon.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor Drat, drat and double drat, I believe Dick Dastardly from the Wacky Races cartoons. I meant to mention this, got side-tracked and completely forgot, sorry. Kindest regards. Mark Lawrence. _

Re: [Tutor] S.find()

2010-07-01 Thread Mark Lawrence
of my code posted up at http://pastebin.com/k9nMZNMy, I won't edit the code until I get this worked out, except maybe a few housekeeping things, documentation, etc.* *I've tried everything I can, and I appreciate your time and help! ~Corey Richardson ___

Re: [Tutor] Python Documentation Clarification

2010-07-12 Thread Mark Lawrence
ation... ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor HTH. Mark Lawrence ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscri

Re: [Tutor] A file containing a string of 1 billion random digits.

2010-07-17 Thread Mark Lawrence
i.e. use 'wb' instead of 'w', and don't bother converting to strings? Then when reading the file use 'rb' instead of 'r'. HTH. Mark Lawrence. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] position of an element in list:

2010-07-23 Thread Mark Lawrence
ained within s[start:end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure. Mark Lawrence ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Calculating and returning possible combinations of elements from a given set

2010-07-27 Thread Mark Lawrence
advance! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor The lazy way. http://docs.python.org/library/itertools.html Look for combinations(). HTH. Mark Lawrenc

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

2010-07-28 Thread Mark Tolonen
s you are trying to print, but it worked on my US Windows 'cp437' console. -Mark ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

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

2010-07-28 Thread Mark Tolonen
", my_dmg / 2, "damage!" print my_hp = my_hp - mo_dmg print "I was attacked by the lk for ", mo_dmg," damage!" print "My Hit Points are ", my_hp print The keyword 'break' will exit a w

Re: [Tutor] string editing

2010-07-31 Thread Mark Lawrence
t;> ankur = "this is ankur" >>> ankur.replace(' ', '\ ') 'this\\ is\\ ankur' HTH. Mark Lawrence. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread Mark Lawrence
look at the actual Python test code in the Lib\test\ directory. Depending on the code that you're wanting to test you might also want to google for mock+objects, but this can wait until you've got your feet under the table. HTH. Mar

Re: [Tutor] Scripting Blender

2010-08-11 Thread Mark Young
2010/8/11 Corey Richardson > Yes. It's called the Python API, it comes with Blender ;) bpy and Blender > are the top modules. There are submodules for everything. The reference is > here: http://www.blender.org/documentation/249PythonDoc/index.html > > HTH, > ~Corey Richardson > > aug dawg wrote:

Re: [Tutor] How to print the installed web browser

2010-09-01 Thread Mark Weil
Not perfect, but you could check for each browser's binary. import os os.path.isfile("/usr/bin/firefox") ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] iterating over less than a full list

2010-09-04 Thread Mark Lawrence
else: break Cheers. Mark Lawrence. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Arguments from the command line

2010-09-06 Thread Mark Weil
I think you're looking for this: http://docs.python.org/library/argparse.html you'll also want to read up on sys.argv http://docs.python.org/library/sys.html#sys.argv On Mon, Sep 6, 2010 at 8:48 AM, aug dawg wrote: > I've seen Python programs that can be activated from the command line. For

Re: [Tutor] IDE for Python

2010-10-07 Thread Mark Weil
There's also eric. It's geared towards pyqt slightly, but I do a lot of wxpython development in it as well. It's got project management and svn plugins, too. http://eric-ide.python-projects.org/ On Fri, Oct 8, 2010 at 6:01 AM, Sayth Renshaw wrote: > > Message: 5 >> Date: Thu, 07 Oct 2010 20:08:10

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

2010-11-05 Thread Mark Tolonen
turn False To: return confirmed == 'n' Also see PEP8 (http://www.python.org/dev/peps/pep-0008/) for Python's suggested coding standard. -Mark ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Removing control characters

2009-02-19 Thread Mark Tolonen
7; >>> b=''.join(n for n in a if ord(n) >= 32 and ord(n) <= 126) >>> b ' !"#$%&\'()*+,-./0123456789:;<=>?...@abcdefghijklmnopqrstuvwxyz[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~' -Mark "Dinesh B Vadhia" wrote in message news

Re: [Tutor] Removing control characters

2009-02-19 Thread Mark Tolonen
t. Kent is right, translate is what you want. The join is still nice for making the translation table: table = ''.join(' ' if n < 32 or n > 126 else chr(n) for n in xrange(256)) string.translate('here is\x01my\xffstring',table) 'here is my string' -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] new print statement + time module

2009-02-27 Thread Mark Tolonen
Maybe there is a trick to force python printing ot in due time, but I have no idea, sorry. stdout is line-buffered. Here's the trick: import time import sys for l in 'the answer': print(l,end='') sys.stdout.flush() time.sleep(0.1) -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] TypeError: dict objects are unhashable

2009-03-14 Thread Mark Tolonen
x27;ggg'}] set(l1) TypeError: dict objects are unhashable but, {'a': 'ddd'} == {'a': 'ddd'} True How about: l1 = [{'a': 'ddd'}, {'a': 'ddd'}, {'b': 'eee'}, {'c': 'ggg&#x

Re: [Tutor] Opening a cmd.exe

2009-03-22 Thread Mark Tolonen
want the window to stay open after executing the commands, use /k instead of /c. 'cmd /?' gives other switches you might want. The escaping(^) of the ampersands(&) is required or the commands will run in the current console not the new one. import os os.system(&#x

Re: [Tutor] irregular/parse/sort

2009-03-22 Thread Mark Tolonen
print 'pKaRes %s %d %s,value= %s' % (line[:3],int(line[5:9]),line[4],line[10:]) -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Syntax error

2009-03-22 Thread Mark Tolonen
ing 3.x where it was renamed to "input". In Python 2.x: print "Game Over" raw_input("\n\nPress the enter key to exit.") In Python 3.x: print("Game Over") input("\n\nPress the enter key to exit.") -Mark "John J

Re: [Tutor] how are unicode chars represented?

2009-03-30 Thread Mark Tolonen
Python handy? This exposes the implementation as UTF-16. len(x) 2 x[0] u'\ud808' x[1] u'\udf45' -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

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
print('Backup Failed') else: print('Successful backup to',target) -Mark "Benjamin Serrato" wrote in message news:dde7cc5d0904051354v1c103fb2wf28f182734970...@mail.gmail.com... Please tell me why this code fails. I am new and I don't understand why my

Re: [Tutor] Please use plain text.

2009-04-06 Thread Mark Tolonen
unless your editor completely supports editing in it (mine doesn't), so I second the motion to post only plain text. -Mark "Wayne Watson" wrote in message news:49dad279.2000...@sbcglobal.net... That's strange--tiny image below. I use SeaMonkey, and it seems to be almost i

Re: [Tutor] Optional groups in RE's

2009-04-11 Thread Mark Tolonen
>>>> data = "42 sdlfks d f60 sdf sdf >>>> Title" [ re attempts stripped] Your data looks like XML. If it is actually well-formed XML, have you tried ElementTree? PythonWin 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32. Portions Copy

Re: [Tutor] Encode problem

2009-05-04 Thread Mark Tolonen
--- Here is the content of my utf-8 file: - [files] file3 = ascii.txt file2 = chinese.txt file1 = blah.txt file5 = ÀÈÌÒÙ.txt file4 = other.txt [马克] 多少 = 明白 Hope this helps, Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

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
k awhile to train myself not to write: file = open('filename.txt') and incorrectly shadow the built-in. It's just the most natural name for the variable :^) -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

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

2009-06-04 Thread Mark Tolonen
It's a bad idea to change the encoding through site.py. Your script won't work on any other system. -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

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

2009-06-06 Thread Mark Tolonen
t): File "", line 1, in TypeError: f() takes exactly 2 arguments (3 given) But there is a syntax to pass keyword arguments as a dictionary: f(1,2,**{'c':3}) 1 2 {'c': 3} -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Writing a csv from a dictionary

2009-06-22 Thread Mark Tolonen
sv.writer(myfile, dialect='excel') for k,[a,b,c] in dyc.items(): mywriter.writerow([k,a,b,c]) myfile.close() OUTPUT: a50,textfield,50,40 k77,othertext,60,10 If you want quoted text fields use: mywriter = csv.writer(myfile, dialect='excel',quoting=csv.QUOTE_NONNUMERIC) -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

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
or external command, operable program or batch file. 255 os.system('echo Hello^|World') Hello|World 0 -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Need help with python game program

2009-06-30 Thread Mark Tolonen
something similar. Use the random module. There are various types of random number generation there, such as: x = random.randint(5,10) -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] window graphics

2009-07-03 Thread Mark Tolonen
; is not defined". Also for the word "canvas" As you suggest, I probably need to start with a 2.x version. Python is case-sensitive. Try "tk = Tk()" and "Canvas". -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] UnicodeEncodeError

2009-07-19 Thread Mark Tolonen
ascii-only. Try print(ascii(line)). Another trick is to switch to Lucida Console font and change the console's code page to 1252 with the command "chcp 1252". This font and code page supports the EM DASH and will display the text properly with print(line).

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
DIGIT SEVEN ARABIC-INDIC DIGIT TWO ARABIC-INDIC DIGIT FIVE ARABIC-INDIC DIGIT SEVEN ARABIC-INDIC DIGIT TWO ARABIC-INDIC DIGIT ZERO ARABIC-INDIC DIGIT ZERO ARABIC-INDIC DIGIT EIGHT -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] this module

2009-08-07 Thread Mark Young
Hi, I was reading a tutorial, and it mentioned the "import this" easter egg. I was curious, and looked up the contents of the module, and dscovered that it had attributes c, d, i, and s. I was wondering if anyone had any clue what these attributes were supposed to mean. I think (this.s) is the zen

Re: [Tutor] this module

2009-08-08 Thread Mark Young
Thanks everybody, I didn't know modules ran code when you imported them, I just thought they defined the functions, etc. in them. Thanks for the info. I'm going to go look at the module's code now that I know where it's at. Mark Young _

Re: [Tutor] mapping/filtering a sequence

2009-09-05 Thread Mark Tolonen
n,n) for n in L] [30, 31, 32, 33, 34, 35, 36, 37, 34, 39, 39] -Mark ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

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] New guy question...

2009-09-14 Thread Mark Freeman
Have you tried running this line by line through the interactive shell? Given, I'm not doing this on a mac, but your input() call doesn't fail for me. I'm using Python 2.6. mark ___ Tutor maillist - Tutor@python.org To unsubs

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

2009-09-19 Thread Mark Tolonen
e first comma-delimited thing in record. str(x) is redundant. x will be a string already. What do you want this function to do? array = [] for x in bigMethod(): array.append(getMark(x)) array1=[] for count in array: array1 = [[count],[x]] for v in array1: print v What

Re: [Tutor] How to perform variable assignment and

2009-10-03 Thread Mark Tolonen
o KeyError. Default on missing is to return None. help(os.environ.get) Help on method get in module os: get(self, key, failobj=None) method of os._Environ instance -Mark ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription opt

[Tutor] What language should I learn after Python?

2009-10-06 Thread Mark Young
, if it's the wrong place, I'm sorry. Mark Young ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread Mark Young
I have no real need to learn anything for a job, it's just a hobby right now. I mostly just want "a programming language that has a different philosophy or approach than Python". However, you guys are right, if I just learn a language without a reason, it will be worthless. When I tried to learn

Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread Mark Young
a project with other people before, so it would definitely be helpful, for both my Python and for whatever language I pick up. I think I may wait a bit though, so I can actually help someone instead of slowing them down. Anyway, thanks everyone for the input, you've

Re: [Tutor] What language should I learn after Python?

2009-10-07 Thread Mark Young
2009/10/7 Serdar Tumgoren > And in case you hadn't heard enough suggestions yet, here's something > I just stumbled into this morning: > > Programming Paradigms for Dummies, by Peter Norvig > http://lambda-the-ultimate.org/node/3465 > > Here's a portion of the soundbite from the website (where yo

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

2009-10-13 Thread Mark Tolonen
n last came up I think we went round that loop and discovered that it didn't. Happy to be wrong. :) That still works, but it only ever worked for command.com (the 16-bit command interpreter that still comes with Windows XP). A 16-bit DOS program or a batch file explicitly ru

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
the *same* list object, so modifying one modifies all: >>> L[2][0]=1 >>> L [[1, 0], [1, 0], [1, 0], [1, 0]] Use a list comprehension to create lists of lists, where each list is a *new* list: >>> L = [[0,0]

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

2009-11-14 Thread Mark Tolonen
stered program for the '.py' extension to run the script. It doesn't use the PATH. You can see the default program for an extension from the command line with the 'assoc' and 'ftype' commands: C:\>assoc .py .p

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

2009-11-14 Thread Mark Tolonen
ding: cp720 u'abc'.encode('cp1256') 'abc' If you are running on an Arabic version of Windows, you might change the console code page to 1256 and see if that works. Run 'chcp 1256' before running 'python'. -Mark ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

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

2009-11-15 Thread Mark Tolonen
he encoding of the terminal to decode stdin and encode to stdout. Implementing a cp720 codec would likely fix the problem. -Mark "ALAN GAULD" wrote in message news:339296.66934...@web86707.mail.ird.yahoo.com... Forwarding to the tutor list with cut n paste sessions. It looks to m

[Tutor] (no subject)

2009-11-20 Thread mark guinder
ok, all i know is that i have python installed on my computer(mac), and i know how to open up "IDLE", how do i write my first program, what do i use , how do i open that, and how to i save it as a prograam? ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] Send Hex

2009-12-18 Thread Mark Tolonen
ectly to a serial port or file. Each character in the string is a byte of data. If you actually need to send hexadecimal characters as text, the binascii module has hexlify: >>> import binascii >>> import time >>

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

2010-01-08 Thread Mark Tolonen
how do I force split to only evaluate the first two columns? Better yet, can I tell split to not evaluate commas in the double quoted 3rd column? Check out the csv, zipfile, and gzip modules in the Python documentation. -Mark ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tkinter questions

2004-12-18 Thread Mark Kels
> I find the easiest way is to create an PhotoImage object attach > the graphic file(jpg,bmp,gif) to that and assign the PhotoImage > object to the Button.image property. You can "animate" the image > by simply reassigning the file to the underlying PhotoImage onject. Thanks, but a practical expla

Re: [Tutor] Tkinter questions

2004-12-20 Thread Mark Kels
On Mon, 20 Dec 2004 18:21:13 +1300, Liam Clarke <[EMAIL PROTECTED]> wrote: > from Tkinter import * > import Image, ImageTk > root = Tk() > img = Image.open('SonicCruiser.gif') > phi = ImageTk.PhotoImage(img) > button = Button(root, image=phi) > button.pack() > root.mainloop() Thank you !! But I d

  1   2   3   4   5   6   7   8   9   10   >