left a message of condolence on behalf of the tutor list.
> >
> > Alan G.
> > List moderator.
>
--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell it."
+wesley chun <http://google.com/+WesleyChun> : wescpy at gmail : @
>
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.flickr.com/photos/alangauldphotos
>
>
> ___
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.pytho
> >Tutor maillist - Tutor@python.org
> >To unsubscribe or change subscription options:
> >https://mail.python.org/mailman/listinfo/tutor
>
>
> ___
> Tutor maillist - Tutor@python.org
> To unsub
hat you want... only what you tell it."
+wesley chun <http://google.com/+WesleyChun> : wescpy at gmail : @wescpy
<http://twitter.com/wescpy>
Python training & consulting : http://CyberwebConsulting.com
"Core Python" books : http:
see what has been said in
the past.
I also answered this question on Quora
<http://www.quora.com/Python-programming-language-1/As-someone-interested-in-learning-Python-should-I-start-with-2-x-or-go-straight-to-3-x/answer/Wesley-Chun>and
provided several references as well as a few talks I&
goal if possible. It will help us understand what programming
>> model you've got in your head. For example, can you explain what the
>> first three lines of your program are intended to do?
>>
>
>
>
> --
> Thank you,
> Danielle Salaz
> Signature Fin
- - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell it."
+wesley chun <http://google.com/+WesleyChun> : wescpy at gmail :
@wescpy<http://twitter.com/wescpy>
Python training & consulting :
- - - - -
"A computer never does what you want... only what you tell it."
+wesley chun <http://google.com/+WesleyChun> : wescpy at gmail :
@wescpy<http://twitter.com/wescpy>
Python training & consulting : http://CyberwebConsulting.com
"Core Python"
>>> __builtins__.Exception
you can also find out what all the other built-ins are using dir():
>>> dir(__builtins__)
['ArithmeticError', 'AssertionError', 'AttributeError',...]
hope this helps!
--wesley
- - - - - - - - - - - - - - - - - - - - - - -
one for someone.
>
>
--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell it."
+wesley chun <http://google.com/+WesleyChun> : wescpy at gmail :
@wescpy<http://twitter.com/wescpy>
Pyth
line resources and having a hard time coming up
>>> with
>>> >> anything.
>>> >> Please help!
>>> >>
>>> >> composers = ['Antheil', 'Saint-Saens', 'Beethoven', 'Easdale',
>>> 'Nielsen']
As I
> said before these results will not be consistent from one computer to
> another.
>
>
> Oscar
> _______
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/
milar purposes however, it's easy to move back-n-forth between either
via dict(), dict.items(), iter/zip(), etc.
cheers,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell it."
+wesley chun : wescpy at gmai
and add either the cost or zero,
respectively. that will help keep your code less complex as well. you would
just be maintaining a running total until the user is done with all their
selections.
good luck!
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A computer never doe
27;t think of any others... can you?
best regards,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell it."
+wesley chun : wescpy at gmail : @wescpy
Python training & consulting : http://Cyberweb
_
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/**mailman/listinfo/tutor<http://mail.python.org/mailman/listinfo/tutor>
>
--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell
another option that no one has mentioned yet is the use of 'ctypes'
with existing C libraries: http://docs.python.org/library/ctypes
cheers,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell it.&qu
fresh install, document the procedure, and make a
blogpost out of it! :-)
cheers,
--wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell it."
wesley chun : wescpy at gmail : @wescpy/+wescpy
Python training &
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell it."
wesley chun : wescpy at gmail : @wescpy/+wescpy
Python training & consulting : http://CyberwebConsulting.com
"Core Python" books : http://CorePython.com
Python
my
Python courses that a student recorded. if interested in viewing it,
you can find it half-way down http://cyberwebconsulting.com
hope this helps!
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell it."
wesley chun
still there even after the loop has
ended. it's as if you did the following:
>>> i = 0
>>> print i
0
>>> i = 1
:
>>> i = 4
>>> print i # 1st time, part of the "loop"
4
>>> print i # 2nd time, "outside&quo
://cyberwebconsulting.com
cheers,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell it."
wesley chun : wescpy at gmail : @wescpy/+wescpy
Python training & consulting : CyberwebConsulting.co
ners with no programing
> experience. Can you please suggest me a good one to use. Thank you.
>
> Walter
--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell it."
wesley chun : wescpy at gmail : @wescpy/+we
- - - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell it."
wesley chun : wescpy at gmail : @wescpy/+wescpy
Python training & consulting : CyberwebConsulting.com
"Core Python" books : CorePython.com
Python-flavored blog:
estions, please cut-n-paste your code here
along with the output, and everyone can help you more effectively.
谢谢!
-- wesley - 陈仲才
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell it."
wesley chun : wescpy at gma
你好 Xianming,
I have a book -- *Python 核 心 编 程 (第二版)* -- that is for people who already
program but want to learn Python. It is available in China from at least 3
online stores:
http://www.china-pub.com/39969
http://www.amazon.cn/dp/bkbk835890
http://mall.sina.com.cn/product_1749023.htm
In the A
i want to expand specifically on steve's response and note the big
distinction that needs to be made for everyone is that this is primary the
difference between calling a *function* and calling a *method* (which is a
function that belongs to/defined for a class).
with that instance (self), that me
tooting my own horn, http://corepython.com gets good reviews too. however,
it does target existing programmers who want to learn Python as quickly and
as comprehensively as possible. it's not a good book if you're a beginner
to programming or are looking for a pure reference like PER or Nutshell.
what do you think you are missing? is there something in the book that
you don't/can't understand? those of us on the list may be able to
help you out... sometimes humans are better at explaining things than
just books. :-)
best regards,
--wesley
On Sun, Dec 11, 2011 at 6:49 AM, surya k wrote:
Congrats! I love hearing stuff like this... keep them coming! I'm curious
as to how Python was able to help you get your job done this time (without
going into anything confidential naturally). What was it about the
language? Or was it specific Python modules/packages you used for the
analysis?
Do
27;foo')
Traceback (most recent call last):
File "", line 1, in
File "", line 1, in
NameError: name 'foo' is not defined
>>> eval("'foo'")
'foo'
-wesley
On Sat, Jul 23, 2011 at 12:06 PM, wesley chun wrote:
> %s
%s = send object to str() first then drop it into the string
%r = send object to repr() first then drop it into the string
pretty straightforward:
>>> x = 'foo'
>>> str(x)
'foo'
>>> repr(x)
"'foo'"
why do people do %r at all? to get the quotes for free: :-)
>>> x = 'Python'
>>> print "What is t
On Sat, Jun 18, 2011 at 10:02 PM, Kaustubh Pratap chand
wrote:
> Hello i made this program which interprets brainf***
>
> But i don't understand why it doesn't endsand also it doesn't print
> anything
can you tell us more about the code other than "it doesn't end" and
"it doesn't print anythi
i strongly recommend you consider using the 2to3 tool if porting apps
from 2.x to 3.x... it will show you much more than you may think.
here's the output from the 2.7 version of 2to3:
$ 2to3 test.py
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
R
>> import re
>> file = open('file.txt','r')
>> file2 = open('newfile.txt','w')
>>
>> LineFile = ' '
>>
>> for line in file:
>> LineFile += line
>>
>> StripRcvdCnt = re.compile('(P\w+\S\Content|Re\w+\S\Content)')
>>
>> FindRcvdCnt = re.findall(StripRcvdCnt, LineFile)
>>
>> for SrcStr in FindRcvdC
> [...] I'm finding that I
> understand concepts, but have no real way to implement them.
>
> So now my problem emerges... can anyone give me suggestions of exercises I
> should do to help improve my knowledge of what I can "actually" do with the
> concepts I have.
michael,
first of all, welcom
input() must be avoided at all costs in Python 2.x. if you find any
Python (2.x) book which employs that, consider the author uninformed.
it is a huge security risk and the main reason why in Python 3
raw_input() is renamed to and replaces input().
cheers,
-- wesley
- - - - - - - - - - - - - - - -
>> Object Oriented Programming" by Dusty Phillips - and found it on Amazon for
>> $43 new on up and $70 for used but maybe that was hardback? Do you happen
>> to know of some other way to obtain it for less than $45?
the retail price of the book is $49.99, and Packt books are usually
POD (print o
On Mon, Jan 10, 2011 at 8:54 AM, bob gailer wrote:
> On 1/10/2011 11:07 AM, Karim wrote:
>
>>
>> s ='xyz'
>> >>> t = str('xyz')
>>
>> >>> id(s) == id(t)
>> True
>>
>> Thus if I create 2 different instances of string if the string is
>> identical (numerically).
>>
>
> Python "interns" certain lite
On Sat, Dec 18, 2010 at 8:13 PM, Hugo Arts wrote:
> On Sun, Dec 19, 2010 at 4:42 AM, Lea Parker wrote:
>> I am having problems working out what I have done incorrectly. The game over
>> block writing should stay on the same line but the bottom half of the word
>> over comes up next to the top hal
On Fri, Dec 17, 2010 at 4:17 PM, Emile van Sebille wrote:
> On 12/17/2010 4:07 PM jtl999 said...
>>
>> I want to pass a variable to os.system which is dir
> dir=raw_input ("Dir Please ")
> os.system ("ls" + dir)
>> sh: ls/: No such file or directory
>
> this has concatenated "ls" and dir
On Thu, Dec 16, 2010 at 10:13 AM, bob gailer wrote:
> I agree. What do we do to fix the "problem"?
something like "quit" (or friends) might be nice, as they are already
special cases in the interpreter:
$ python
Python 2.5.1 (r251:54863, Feb 9 2009, 18:49:36)
[GCC 4.0.1 (Apple Inc. build 5465)]
On Sat, Dec 4, 2010 at 12:44 PM, Brett Ritter wrote:
> On Sat, Dec 4, 2010 at 2:27 PM, Kirk Bailey wrote:
>> and continue in html. What a BLOODY shame we can't do that in python,
>> which is otherwise awesome and superior in every way i can thus far
>> evaluate.
>
> As someone mentioned, you CAN
> Straightaway, i was impressed by one powerful property; the ability to
> imbed php into a html webpage, and switch into and out of php as needed,
> and let normal ssi and html and css work the rest of the time, outside
> of php. all I have to do is start the php block with
> write code;
> ?> # e
On Sun, Nov 28, 2010 at 7:18 PM, Terry Carroll wrote:
> On Thu, 25 Nov 2010, Alan Gauld wrote:
>> "Yves Dextraze" wrote
>>> Sent from my iPod
>>
>> There is no mention on Amazon of any new editions and they usually
>> announce several months in advance...
>>
>> A pity a new Tkinter book using Tix
greetings and welcome (back) to Python! i have a few comments for you:
1. The syntax for Python 3.x has changed from 2.x, so please be aware
of the differences as you are learning. Most books and code out there
is still 2.x. 3.x is being adopted but because of the differences, it
is slower than mo
correct, it is a floating point issue regardless of language.. it's
not just Python. you cannot accurately represent repeating fractions
with binary digits (bits). more info specific to Python here:
http://docs.python.org/tutorial/floatingpoint.html
also, keep in mind that '%f' is not a rounding o
> guys can i use python's win32com module to do the same tasks that i do with
> visual basic for applications (vba). I mean automating tasks for excel e.t.c
> and accessing Access databases. If win32com doesnt which module can i use?
that's definitely the right one, and yes, you can use VB/VBA
> When sets were introduced to Python in version 2.3. they came as a separate
> "sets" module.
>
> In version 2.6 built-in set/frozenset types replaced this module.
2.4
> So either way is OK for now, but the sets module might go away in a newer
> version.
agreed
cheers,
-- wesley
- - - - - -
t a copy of Python Web Development with Django
> last month, and I can't recommend it enough.
>
> On Wed, Apr 7, 2010 at 8:46 PM, wesley chun wrote:
>>
>> i worked on another well-received Django book with a pair of great
>> co-authors called "Pytho
i worked on another well-received Django book with a pair of great
co-authors called "Python Web Development with Django", Addison Wesley
(2009).
rather than taking the existing Django docs, which are great BTW, and
expanding on them, we wanted to have a more comprehensive look at
Django developme
similarly, you get an error if:
"print int(reply) ** 2
print 'Bye'"
... is all a single line and/or if you mixed spaces and TABs.
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
"Python Fundamentals", Prentice Hall,
> what text-editor do you use for python?
as an FYI Guido himself uses both emacs and vi/m... he mentioned this
during his PyCon 2010 keynote last week, to which someone tweeted:
http://twitter.com/bradallen137/status/9337630806
i primarily use vi/m and emacs as necessary,
-- wesley
- - - - - -
> I just wrote this message, but after restarting ipython all worked fine.
> How is it to be explained that I first had a namespace error which, after a
> restart (and not merely a new "run Sande_celsius-main.py"), went away? I
> mean, surely the namespace should not be impacted by ipython at all!?
as well?
>
> On Fri, Jan 29, 2010 at 3:15 PM, David Abbott wrote:
>>
>> A group of beginners and intermediate Pythonerrs and getting together to
>> study the book Core Python Programming by Wesley Chun. We are starting
>> on chapter one on Feb first. We are hoping to
for future reference, you can go sign up for the courses at
http://foothill.edu ... i'll be delivering the intermediate Python
course next year FWIW.
cheers,
-wesley
On Fri, Jan 29, 2010 at 10:45 AM, Scott Pritchard wrote:
> Oh, sorry about that.
>
> Rich Lovely wrote:
>>
>> I think you've got
On Sun, Jan 17, 2010 at 5:19 PM, Alan Gauld wrote:
>
> "Magnus Kriel" wrote
>
>> It might be that when you create a file for the first time with 'a', that
>> it
>> will through an exception. So you will have to try with 'w', and if there
>> is
>> an exception, you know the file does not exist and
> while True:
> name = raw_input("what is the name ")
> age = raw_input("what is the age ")
>
> out_file = open("persons.txt", "w")
> out_file.write("name: ")
> out_file.write(name)
> out_file.write("\n")
> out_file.write("age: ")
> out_file.w
On Sun, Jan 17, 2010 at 12:10 PM, Robert wrote:
> In the Python tutorial (highlighted here http://awurl.com/N1XvzIo2Q)
>
> What exactly is "dynamic name resolution" ? specifically what is
> "dynamic" about it ?
what this means is that as your code is executing and the interpreter
encounters an i
> I have a file generated from a webpage.
> I want to search that file for a specific keyword, in my case 'NEW'.
> Once I have found that keyword I want to retrieve information below it, e.g.
> web link, size of file etc.
> When I have this information I move off until I find another 'NEW' and the
> I have a tab-delim file:
>
> col1 col2 col3
> andrew 1987 1990
> jake 1974 1980
> jim 1964 1970
> lance 1984 1992
>
> how can I sort column 2 and get :
> jim 1964 1970
> jake 1974 1980
> lance 1984 1992
> andrew 198
> - learning to program by gauld http://www.freenetpages.co.uk/hp/alan.gauld/
update: alan's latest tutorial lives here: http://www.alan-g.me.uk/tutor/
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Python Web Development with Django", Addison Wesley, (c) 2009
http://w
> I wan't to buy some books about python 3. Do you have any recommendations?
> I started with no previous programming experience, and I've finished a few
> tutorials and I guess I can be considered a beginner.
greetings khalid, and welcome to Python!
based on your background, i would like you s
>> I have the first edition of your book. What is the difference between
>> two editions?
i believe the 1st ed is 3.0 and the 2nd ed is 3.1 but haven't
confirmed with him yet.
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2
On Tue, Nov 24, 2009 at 2:42 PM, Bo Li wrote:
>
> I am new to Python and having questions about its usage. Currently I have to
> read two .csv files INCT and INMRI which are similar to this:
> [...]
> I was a MATLAB user and am really confused by what happens with me. I wish
> someone could help
On Wed, Nov 18, 2009 at 1:51 PM, GoodPotatoes wrote:
> I'm dealing with bigger lists than I have been, and noticed this is getting
> really slow. Is there a faster way to do this?
>
> for x in list1:
> if x not in list2:
> list3.append(x)
>
> My search is taking up to 5 minutes to com
>> Should I advise him to
>> stick with 2.6 for a bit, since most of the material out there will
>> be for 2.x? Or since he's learning from scratch, should he jump
>> straight to 3.x In which case what can you recommend for him to work
>> through - I must stress he has absolutely no clue at all
>> i get asked this question a lot, esp. when it pertains to my book,
>> "Core Python Programming." which should i learn? is your book
>> obsolete? etc. i basically tell them that even though they are
>> backwards-incompatible, it's not like Python 2 and 3 are so
>> different that you wouldn't
>> My brother in law is learning python. He's downloaded 3.1 for
>> Windows, and is having a play. It's already confused him that print
>> "hello world" gives a syntax error
>>
>> He's an absolute beginner with no programming experience at all. I
>> think he might be following 'Python Progra
hey gang, not sure i made the original announcement on this list a few
months ago, but if you're on this list because you need to learn
Python as quickly and as in-depth as possible for an immediate need, i
have few more openings in my upcoming course in San Francisco, and
below is the reminder i'v
> I've been studying python now for a few weeks and I've recently come
> into list comprehensions. [...]
> Those make sense to me. The way I understand them is:
> do something to x for each x in list, with an optional qualifier.
that's pretty much correct.
> On the other hand I've seen a few exa
> Thanks all for the informative discussion. To re-confirm it was mostly
> for boolean checks like "if b == True".
wow, as the OP, you must have been surprised to see how far we have
taken your (seemingly) simple question. we went from boolean checks to
interning! commenting on my previous reply,
On Mon, Oct 5, 2009 at 2:24 PM, Nick Hird wrote:
> What is the best version of python to start out with? I see some
> discussions on the net about not going to 3.1 but staying with the 2.x
> releases. But then i see that 3.1 is better if your just starting.
greetings nick!
ironically, i just ga
> I am going through someone's python script and I am seeing a lot of the
> following boolean checks.
>
> if not s == ""
> if not n == 0
> if b == True
> if not b == True
> etc..
>
> All of these can be written without the == notation like "if n", "if s"
> etc.Now in this case where it is only used
> def __init__(self, time, mods=[], dur=None, format='%1.2f'):
> :
> The mods that were added to the first instance of oneStim also appear in the
> second, newly created instance!
>
> It appears that what is happening here is that the __init__() method is
> being parsed by the interpreter
> I would like to create a program which
> should repeat a simply string several times with list number before.
> Like "1. Wanna more. 2. Wanna more. ..."
> Suppose to a loop here repeating, say x times. Should it look like that:
>
> y="Wanna more. "
> x=1
> x=x+d:
> d=<100
> print d+y
>
> How to c
On Fri, Oct 2, 2009 at 11:14 PM, Oxymoron wrote:
> Hello,
>
> On Sat, Oct 3, 2009 at 3:56 PM, Didar Hossain
> wrote:
>>
>> homedir = os.environ.get('HOME')
>>
>> if homedir:
>> print "My home directory is %s" % homedir
>>
>>
>> I do this in Perl -
>>
>> my $home;
>>
>> if ($home = $ENV{'HOME'}
> I need help writting a program.
> 1) Random string generation
> 2) no repeating letters
> Can anyone help me,please? I am so confused. The only problem is I have to
> use the code that is written there but add on to it.
>
> import random
>
> alphabet = "abcdefghijklmnopqrstuvwxyz"
> myNewString =
>> I tried this:
>> win32net.NetUseDel(None, 1,{'local':'k:'})
>>
>> but I got this error:
>> Traceback (most recent call last):
>> File "test.py", line 33, in
>> win32net.NetUseDel(None, 1,{'local':'k:'})
>> TypeError: an integer is required
>
> You have the wrong sequence for NetUseDel().
On Mon, Sep 21, 2009 at 2:06 PM, Wayne wrote:
> On Mon, Sep 21, 2009 at 4:00 PM, kreglet wrote:
>>
>> I keep getting the following error and don't uderstand why:
>>
>> Traceback (most recent call last):
>> File "/home/kreglet/bin/test.py", line 15, in btnStatclick
>> btnStat.set_label("Presse
>> an expression is something ... that evaluates to *some* Python object
>>:
>> in contrast, a statement is something that has no intrinsic value
>
> Umm.you just completely confused me. What does it do?
ok, now *i*'m the one confused... what does *what* do?
both expression
>> Just think: 4 players left means that this is the semi final.
>
> What a brilliant answer! It tells him how to do it if he just stops and
> thinks but gives nothing away. I love it. :-)
i agree with alan on this. in fact, i can just picture the brackets in
my head already. :-)
another thing f
hi Giorgio,
welcome to Python (whether directly or from GAE!) :-) my comments below.
> with import i can import modules or single functions. And this is ok.
not quite true. regardless of whether you use import or from-import,
you're *always* importing (and loading) modules or packages in their
On Wed, Aug 12, 2009 at 1:07 PM, David Kim wrote:
> Unfortunately I live on the East Coast, otherwise I'd definitely attend! I
> am attracted to the declarative nature of reStructuredText, but I also
> recognize that A LOT of people use Powerpoint and are comfortable with it.
> Going with something
> I'm wondering what people consider the most efficient and brain-damage free
> way to automate the creation of presentation slides with Python. Scripting
> Powerpoint via COM?
this is how i'm doing it. i'm working on a Python script that takes
plain text with minimal markup that then uses COM t
On Thu, Jul 30, 2009 at 11:18 AM, Che M wrote:
> Did you actually look at what happens when you click that
> link? (i.e. where you are brought to?).
>
> Because upon viewing this I achieved enlightenment! :D
lucky you... i achieved recursion. :-)
___
>> Maybe you could break that up a bit? This is the tutor list, not a
>> one-liner competition!
>
> rather than one-liners, we can try to create the most "Pythonic" solution.
> below's my entry. :-)
>
> myMac$ cat parafiles.py
> #!/usr/bin/env python
>
> from itertools import izip
> from os.path i
> - you probably don't want to call set1.remove(). lists are immutable,
> and you would've change the contents of set1.
sorry, make that "mutable." sets, dicts, and lists are standard Python
types that are mutable.
-wesley
___
Tutor maillist - Tutor@p
> could this be done in a more elegant fashion?
in addition to alan's obvious solution, if you wanted to roll your
own, you have a good start. my comments below.
> def Unite(set1, set2): # evaluate 2 lists, join both into 1 new list
> newList = []
> for item in set1:
>
in addition to the good advice from vince (watch out for greediness
regardless of what you're looking for) and bill (use raw strings...
regexes are one of their primary use cases!), another thing that may
help with the greediness issue are the character sets you're using
inside to match with.
for
On Fri, Jul 24, 2009 at 11:40 PM, Chris Castillo wrote:
> Okay I really need help with the program I am writing. I've can't seem to
> figure out what I need to do and have tried several different methods.
hi chris, and welcome to Python! the tutors here are very helpful to
those who are new to pr
On Fri, Jul 24, 2009 at 2:34 PM, Jesse Harris wrote:
> for d in Decks.all(): #loop thru all available decks
> self.response.out.write(''+d.name)
> self.response.out.write(''+d.description)
> self.response.out.write('')
> self.response.out.write('')
>
> : invalid syntax (main.py,
on a related note, there is a module called fileinput that doesn't do
what you (the OP) need for this particular problem, but it is one to
keep in mind for the future as there may be a situation for which it
is the right tool. it doesn't get a lot of buzz but can come in handy
-- for me, it was in
>> Thankyou sir it is working.but one more thing i want to ask that if my
>> file will have entries like:---
>>
>> fileA and fileB
>> 12 10
>> 13 12
>> 14
>> 15
>>
>> means if their no. of entries will not match then how to combine them(both
>> input files have more than one col
> Maybe you could break that up a bit? This is the tutor list, not a
> one-liner competition!
rather than one-liners, we can try to create the most "Pythonic"
solution. below's my entry. :-)
cheers,
-wesley
myMac$ cat parafiles.py
#!/usr/bin/env python
from itertools import izip
from os.path im
>>> > Can some one give, or point to some good examples of how @decorators
>>> > work, and __call__ (able) objects?
>
> simple example of calling a class
>
> class myKlass(object):
>
> def __call__(self, *args, **kws):
> print "i was called"
>
> >>> test = myKlass()
> >>> test()
> i wa
On Wed, Jul 15, 2009 at 8:29 AM, Rich Lovely wrote:
> 2009/7/15 vince spicer :
>>:
>> import re
>>:
>> values = re.split("\s+", line) # split values on spaces EX: ['47', '8',
>
> That isn't what they're after at all.
> Something more like
> :
> n, pos, ala, at, sy
> I'm not sure if this is good practice, but I could assign a variable within
> the while loop, that is assigned something that will then break the outer
> loop.
>
> while True:
> breakout = True
>
> for i in items:
> if i > 10:
> breakout = False
> else:
>
> So how would you break out from this situation?
as i mentioned in my other msg, you need another break statement that
is *not* in another loop. in your case, not in the for-loop. you need
a break statement somewhere within your while block (again, that's not
in any other loop). IOW, it should be
> The other day I needed to pack a dictionary, the value of each key was a
> list. In the code I was packing the list and the dictionary at the same time.
> First I tried something like this:
>
> list = []
> dict = {}
> x = 1
>
> dict['int'] = list.append(x)
>
> The result was {'int': None}. Why
1 - 100 of 334 matches
Mail list logo