Re: [Tutor] how to compress a folder in python

2011-03-16 Thread Corey Richardson
On 03/16/2011 09:15 AM, bhavanasi sarath wrote: i want to learn how to compress a folder which is having some text filesbut compress that from another directory.. http://docs.python.org/library/zipfile.html (Sorry for the HTML email, getting things set up on new workstation) _

Re: [Tutor] Efficiency of while versus (x)range

2011-03-16 Thread Corey Richardson
e x/range style). Is this the case or does the compiler do > something clever here? > Only way to know is to check! http://docs.python.org/library/timeit.html -- Corey Richardson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Difference

2011-03-20 Thread Corey Richardson
-Original Message- From: ANKUR AGGARWAL To: tutor Sent: Sun, Mar 20, 2011 1:49 pm Subject: [Tutor] Difference Hey want to know whats the difference between the pygame.display.update() and pygame.display.flip() An explanation with the example would be grea. Thanks In Advance Ankur Ag

Re: [Tutor] what is it mean--- File "", line 1

2011-03-20 Thread Corey Richardson
;s what the shell does! So, exit out of the Python interpreter before trying to run that command (>>>exit, or Ctrl-D). -- Corey Richardson (Forgive the horrible formatting and HTML, on the road using a web client) ___ Tutor maillist - Tut

Re: [Tutor] Replying

2011-03-28 Thread Corey Richardson
On 03/28/2011 01:04 PM, markri...@gsoftcon.com wrote: > When replying to the mailing list, does everyone just hit the reply button in > your email program. Because that sends the email directly to your email. Also > everyone is cc'ng the mailing list; is that the exceptable way to reply so > eve

Re: [Tutor] Replying

2011-03-28 Thread Corey Richardson
On 03/28/2011 06:17 PM, Steven D'Aprano wrote: > Corey Richardson wrote: > >> Thunderbird has a "reply list" button that I use. > > It does? What version are you using? 3.1.8 I don't know how it knows what a mailing list is and isn't, but it does. Af

Re: [Tutor] String formatting question.

2011-03-29 Thread Corey Richardson
e using Python 2, you have no option but to use the first, as far as I know. Maybe Python 2.7 has that formatting, I'm not sure. -- Corey Richardson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] GUI IDLE for UBUNTU 10

2011-04-06 Thread Corey Richardson
minal, sudo apt-get install idle. When you need software, search in Synaptic (Package Manager) or google first, it's usually very accessible! -- Corey Richardson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscr

Re: [Tutor] Compound if statement question.

2011-05-01 Thread Corey Richardson
hree elements of L aren't equal to each other. Due to python's short-circuit evaluation, it breaks the if after the first one, because '1' != '4'. The parentheses there are useless. You might look at [1] to see if there is anything that will count how many times somethi

Re: [Tutor] ValueError

2011-05-03 Thread Corey Richardson
e that except. Example: try: foo = int("blargh") except ValueError: pass It looks like you're forgetting an important operation on the inches variable, as well as centimeters later on. Take a look at http://docs.python.org/library/stdtypes.html#typesnumeric For future que

Re: [Tutor] Filtering out unique list elements

2011-05-03 Thread Corey Richardson
e same list but with one occurrence per element: > > [cat, dog, tree, bird, woods] > > Any help much appreciated! The set type enforces uniqueness: http://docs.python.org/library/stdtypes.html#set You would use list(set(l)) to get the list from l where everything is unique. - -- Core

Re: [Tutor] Program

2011-05-18 Thread Corey Richardson
a loop? If you add in a loop, it will also be fairly easy to add in another loop to make sure they enter a name not in the list. So, your pseudo-code might look something like this: for i in range(6): make prompt string; get name; while name in names_gotten: get name; add

Re: [Tutor] Program

2011-05-18 Thread Corey Richardson
ect has no attribute 'append' Yes, because append belongs to list, and not str! http://docs.python.org/tutorial/datastructures.html#more-on-lists words = [ word = raw_input("Name #1: ") words.append(word) Keep in mind the rest of the email I sent, that part was one of the least importa

Re: [Tutor] Non programmer wanting to become programmer

2011-05-26 Thread Corey Richardson
7;t worry about them right away. For things like this I would recommend getting very familiar with Python, and then picking up a bit of C. - -- Corey Richardson -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.17 (GNU/Linux) iQEcBAEBAgAGBQJN3rF9AAoJEAFAbo/KNFvp0nYH

Re: [Tutor] python "glue"

2011-06-05 Thread Corey Richardson
7;s still very *very* limited. For webOS it looks like the only way you'll get Python is if you whip together a C(++) program that statically links to it. - -- Corey Richardson -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.17 (GNU/Linux) iQEcBAEBAgAGBQJN67V8AAoJEAFAbo/KNFvpv/MH/088lDJ

Re: [Tutor] Objects C++ vs Python

2011-06-09 Thread Corey Richardson
printf("%s, age %d\n", d.name, d.age); printf("Address: %s", d.address); } Encapsulate that, and you have yourself an object. OO isn't hard to do, even (single!) inheritance isn't too great of a challenge. It's getting things dynamic instead of static that'

Re: [Tutor] Syntax for Simplest Way to Execute One Python Program Over 1000's of Datasets

2011-06-09 Thread Corey Richardson
t")) > outfile.write("===\n") It may just be me, but I think outfile.write(('=' * 23) + '\n') looks better. > > counts_list = counts.items() > counts_list.sort() > for word in counts_list: > outfile.write("%-18s%d\n" %(word[0], word[1])) > > outfile.close Parenthesis are important! outfile.close is a method object, outfile.close() is a method call. Context managers make this easy, because you don't have to manually close things. Hope it helped, -- Corey Richardson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Lists

2011-06-10 Thread Corey Richardson
et me know if I am wrong... > A wise man once said, > Could you please refrain from presenting your *religious* convictions > in this list: the notions you believe in as well as the ones that you > believe are false? Could be applied to government too. -- Corey Richardson

Re: [Tutor] Building games

2011-06-11 Thread Corey Richardson
o see how things are done, and is always a good learning experience. Cheers, - -- Corey Richardson -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.17 (GNU/Linux) iQEcBAEBAgAGBQJN85uFAAoJEAFAbo/KNFvpaNoIAI0OeY7lnqdTR4AsdOdwZK0k HrZ5xuEaXVyO6UArYvVynoB6cZF+hNGiYmIiv2IO/aYLCjU0WWAvSLfLGD4zgWFR NnHdZvJ7

Re: [Tutor] Need script help with concept

2011-06-17 Thread Corey Richardson
there is a port for Python 3 somewhere too. http://excess.org/urwid/ (Apologies if email is HTML, using a web client) -- Corey Richardson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailma

Re: [Tutor] problem reading script

2011-07-01 Thread Corey Richardson
he differences between i,l, | and 1 and '' and " > and between ' and ` etc. > I use and love inconsolata[0], it's a great font for programming, and looks great as well (both on screen and off). [0] - http://www.levien.com/type/myfonts/inconsolata.html -

Re: [Tutor] Python editor for Ipad

2011-07-21 Thread Corey Richardson
your best bet would probably be Cloud9 or a similar product. -- Corey Richardson "Those who deny freedom to others, deserve it not for themselves" -- Abraham Lincoln signature.asc Description: PGP signature ___ Tutor maillist - Tutor

Re: [Tutor] Python editor for Ipad

2011-07-21 Thread Corey Richardson
Excerpts from Tahir Hafiz's message of Thu Jul 21 16:24:22 -0400 2011: > Cloud9 seems interesting as a browser based IDE. Do you know if there is a > way to run Python code as well create/edit it? > Not as far as I know. -- Corey Richardson "Those who deny freedom to oth

Re: [Tutor] Python editor for Ipad

2011-07-21 Thread Corey Richardson
figure it out. I saw the "Run" button and its configuration, but it looks like it wants a JS file and args? Or...maybe not? -- Corey Richardson "Those who deny freedom to others, deserve it not for themselves" -- Abraham L

Re: [Tutor] Python editor for Ipad

2011-07-21 Thread Corey Richardson
Excerpts from bob gailer's message of Thu Jul 21 17:21:01 -0400 2011: > On 7/21/2011 12:30 PM, Corey Richardson wrote: > > If you have a browser, Cloud9 IDE might be able to do it. > I just tried Cloud9 and gave up in frustration. > > Unintuitive interfacre. No help. F

Re: [Tutor] Question related to Tkinker

2011-07-24 Thread Corey Richardson
d level 2 or is there a way to > just adjust the word (I used labels) > When working with tkinter, http://effbot.org/tkinterbook/ will likely be your best friend. Specifically, you're going to want your_label1.config(text="New word!") your_label2.config(text="Another!&qu

Re: [Tutor] About the Mailing List

2011-07-28 Thread Corey Richardson
e threading feature of your user agent -- or switch to one that has said feature. I know recent thunderbird's do it, if that's the sort of thing you're into. Thread view makes things bucketloads easier. -- Corey Richardson "Those who deny freedom to others, deser

Re: [Tutor] Break Help

2012-05-29 Thread Corey Richardson
On Tue, 29 May 2012 17:50:37 -0700 (PDT) PhantomsCore wrote: > > if gameIsDone: > if playAgain(): > missedLetters = '' > correctLetters = '' > gameIsDone = False > secretWord = getRandomWord(words) > else: > break

Re: [Tutor] iPython check if user running script is root user (Linux)

2012-05-31 Thread Corey Richardson
# > > if [ $(id -u) != "0" ];then >echo "This script must be run as root." >exit 1 > fi import os if os.environ['USER'] != 'root': print('This script must be run as root.') exit(1)

Re: [Tutor] Connecting to MySQLdb

2012-06-01 Thread Corey Richardson
e you can install all the packages you want with pip, without having to worry about mucking up the system, versions of things, etc. Assuming Windows: Good luck! -- Corey Richardson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] use the data None

2012-06-03 Thread Corey Richardson
stions? (I've been away from Python for a bit, one of the other tutors might correct me with better practice things, I'm rusty!) -- Corey Richardson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

<    1   2