On 10/03/16 13:33, Patrick Craine wrote:
> I downloaded Python 2.7.11 but for some reason it seems that it's not
> responding the way it¹s supposed to. I haven¹t been able to figure out the
> problem. I¹m on Mac OSX 10.11.3.
You probably didn't need to download Python because it is
installed by d
On Thu, Mar 10, 2016 at 5:33 AM, Patrick Craine
wrote:
> >>> x = int(raw_input('Enter an integer: '))
> if x%2 == 0:
> print 'Even'
> else:
> print 'Odd'
> if x%3 != 0:
> print 'And not divisible by 3'
> Enter an integer: 3
> >>>
>
> It could be your email program that's messing with your indenta
On 11/11/15 20:12, Mark Lawrence wrote:
On 11/11/2015 19:38, George Henry wrote:
How do I find a site to download Python for Windows that includes a
Toolbar?
So IDLE is not good enough for you? I'll let you find it as it's part
of the standard library, i.e. you've all ready downloaded it.
On 11/11/2015 19:38, George Henry wrote:
How do I find a site to download Python for Windows that includes a Toolbar?
I'm using Windows 8.1 Have tried installing Python 3.4.2 but notice that
the Python shell does not include a tool bar (i.e. File, Edit, Shell, Debug,
etc.).
Help please.
Thank
Hi,
(Sorry for top-postin - I am using my phone).
You can try Spyder IDE, it is part of Anaconda and Python(x, y):
https://pythonhosted.org/spyder/installation.html#installing-on-windows-vista-7-8-10
Regards,
Albert-Jan
> From: gfhenry1...@gmail.com
> To: tutor@python.org
> Date: Wed, 11 Nov 2
On 13/09/13 15:59, Paul Smith wrote:
So there are many tools out there but mechanize and scrapy 3rd party
modules seem to produce the best results; however nothing like these
exist for Python3. I get close but cannot produce the clean simple url
results in python3
Yes that's the biggest barrie
Thanks for the explanation. It's clearer now.
Tommy
"Tommy Kaas" wrote
> > > for row in soup('table', {'class' : 'spad'})[0].tbody('tr'):
> >
> >Do you understand the syntax from a Python point of view?
>
> No. That's the problem.
OK, I'll assume you understand the basic for loop structure
and
"Tommy Kaas" wrote
> > for row in soup('table', {'class' : 'spad'})[0].tbody('tr'):
>
>Do you understand the syntax from a Python point of view?
No. That's the problem.
OK, I'll assume you understand the basic for loop structure
and focus on the function call:
soup('table', {'class' : 'spa
-Oprindelig meddelelse-
Fra: tutor-bounces+tommy.kaas=kaasogmulvad...@python.org
[mailto:tutor-bounces+tommy.kaas=kaasogmulvad...@python.org] På vegne af
Alan Gauld
Sendt: 28. juli 2010 20:00
Til: tutor@python.org
Emne: Re: [Tutor] Newbie question - syntax - BeautifulSoup
"Tommy
"Tommy Kaas" wrote
for row in soup('table', {'class' : 'spad'})[0].tbody('tr'):
The example works fine, and I can change it a bit and it still
works. But I
simply don't understand how I am supposed to the fourth line - after
"for
row in soup". I can clearly see it defines the area I want to
2008/10/16 Emad Nawfal (عماد نوفل) <[EMAIL PROTECTED]>:
> It works fine. It seems that in the file you have there are lines whose
> length is less than you should expect
Yes, my guess is there is a blank line in the file.
Kent
___
Tutor maillist - Tu
On Thu, Oct 16, 2008 at 4:25 AM, Visvaldas K. <[EMAIL PROTECTED]>wrote:
> Hi,
>
> I feel very stupid, but I am stuck. I could try some workaround, but I want
> to understand what I am doing wrong.
>
> The line:
>
> for line in open("parameterfile").readlines( ):
>print line.split()
Here is a solution:
>>> for line in open('DBAN1001.txt').readlines():
... line = line.split()
... if len(line) > 1: # This is what makes it work for me.
... print line[1]
...
it's
have
the
way
that
is
is
prison
we
It works fine. It seems that in the file you have there are lin
"asdg asdg" <[EMAIL PROTECTED]> wrote
You need to add the folder containing this module to your
PYTHONPATH.
Being picky you want to add it to your sys.path value
Python loads sys.path from the values in PYTHONPATH which is
an OS environment variable. Modifying PYTHONPATH after you
start Pyth
You need to add the folder containing this module to your PYTHONPATH.
To do this, go to you interpreter and type:
>>> import sys
>>> sys.path.append("C:\Python25\ExampleFolder")
That path was just an example, insert your own path leading to the desired
folder there.
Python imports it's modules
>From http://diveintopython.org/getting_to_know_python/index.html, we can get
this solution which works no matter the size of the dictionaries:
print ' '.join(["%s" % (v,) for k,v in menu_specials.items()])
It generates a formatted string for value in the dictionary and then joins
them using whit
"jon vspython" <[EMAIL PROTECTED]> wrote
> There's also a specially tailored solution for dictionaries:
>
> print "%(breakfast)s %(lunch)s %(dinner)s" % menu_specials
Good catch! I keep forgetting about that.
I really must get into the habit of using it more often
when working with dictionari
There's also a specially tailored solution for dictionaries:
print "%(breakfast)s %(lunch)s %(dinner)s" % menu_specials
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
"Ramkumar Kashyap" <[EMAIL PROTECTED]> wrote
menu_specials = {"breakfast" : "sausage and eggs",
> ... "lunch" : "split pea soup and garlic bread",
> ... "dinner": "2 hot dogs and onion rings"}
print "%s" % menu_specials["breakfast"]
You don't really need the %s bit it could just be
>>
"Ramkumar Kashyap" <[EMAIL PROTECTED]> wrote
> print "%s %s %s" % menu_specials["breakfast"],
> menu_specials["lunch"],
> menu_specials["dinner"]
Whoops, I also should have added parentheses around the values.
Otherwise Python sees a tuple consisting of the string and first
value followed by the
parseably short, though not quite exactly pithy. :-)
Regards,
Trilok
-Original Message-
From: Luke Paireepinart [mailto:[EMAIL PROTECTED]
Sent: Monday, October 15, 2007 10:03 PM
To: Trilok Khairnar
Cc: tutor@python.org
Subject: Re: [Tutor] newbie question
Trilok Khairnar wrote:
>>
Ramkumar Kashyap wrote:
> Hi all,
>
> I have just started learning to program and am working through the
> Beginning Python from Wrox.
>
> I am working through one of the examples in the books on dictionaries.
> Here is the example.
>
> >>> menu_specials = {"breakfast" : "sausage and eggs",
> ...
Trilok Khairnar wrote:
>> With this, and if you want to use your formatted print statements instead
>>
> of the join, you could use something like
>
>> print "Specials: %s %s %s" % tuple(menu_specials.values()) which turns the
>>
> output of menu_specials.values() (a list) into a tuple
> With this, and if you want to use your formatted print statements instead
of the join, you could use something like
> print "Specials: %s %s %s" % tuple(menu_specials.values()) which turns the
output of menu_specials.values() (a list) into a tuple.
> Disadvantage is that you'll need to know the
r 15, 2007 9:05 PM
To: 'Ramkumar Kashyap'
Cc: 'tutor@python.org'
Subject: RE: [Tutor] newbie question
Either of the following should do it:
print string.join([menu_specials[val] for val in menu_specials], ', ')
or
print string.join([menu_specials[val] for val in me
Hi Ram,
> Either of the following should do it:
>
> print string.join([menu_specials[val] for val in
> menu_specials], ', ')
> or
> print string.join([menu_specials[val] for val in
> menu_specials.keys()],
> ', ')
> or
> print string.join([menu_specials[val] for val in ["breakfa
Either of the following should do it:
print string.join([menu_specials[val] for val in menu_specials], ', ')
or
print string.join([menu_specials[val] for val in menu_specials.keys()],
', ')
or
print string.join([menu_specials[val] for val in ["breakfast", "lunch",
"dinner"] ], ', ')
"bellzii" <[EMAIL PROTECTED]> wrote
> hey everyone , can any1 tell me what does the module optparse do ?
It parses options.
That is it takes a command string and works out what
the various bits mean, in particular the command line
options or "switches".
For example you can call python like this
bellzii wrote:
> hey everyone , can any1 tell me what does the module optparse do ?
It helps parse command line arguments. See the docs at
http://docs.python.org/lib/module-optparse.html
Kent
___
Tutor maillist - Tutor@python.org
http://mail.python.or
On 09/05/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> try:
> print "The fridge contains %s" %fridge[food_sought]
> except (KeyError):
> print "The fridge does not contain %s"%food_sought
[...]
> Is the same true of Python? Or is ok to use Exception handling like the book
> suggests?
<[EMAIL PROTECTED]> wrote
> fridge={"apple":"A shiny red apple","pear":"a nice ripe
> pear","grapes":"seadless grapes"}
> food_sought="apple"
> fridge_list=fridge.keys();
Not sure what this line is for...
> try:
>print "The fridge contains %s" %fridge[food_sought]
> except (KeyError):
>
2007/5/8, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> I'm working my way through the book "beginning python" and I came across an
> exercise that suggests using Exception trapping to see if a value is in a
> dictionary:
>
> fridge={"apple":"A shiny red apple","pear":"a nice ripe
> pear","grapes":"s
[EMAIL PROTECTED] wrote:
> I'm working my way through the book "beginning python" and I came across an
> exercise that suggests using Exception trapping to see if a value is in a
> dictionary:
>
> fridge={"apple":"A shiny red apple","pear":"a nice ripe
> pear","grapes":"seadless grapes"}
> food_
Guba Castro wrote:
> The links you sent me are helpful, many thanks for that. Maybe there is
> another site you might be able to recommend to me: what I want to do
> with Python in primarily (Linux) scripting. Any ideas?
What do you mean by "Linux scripting"? If you want to work with files
and d
"Kent Johnson" <[EMAIL PROTECTED]> wrote
> Several good beginners tutorials are listed here:
> http://wiki.python.org/moin/BeginnersGuide/NonProgrammers
But very few of them will have been updated to reflect
changes in 2.5. My own tutor is accurate for 2.3.
This is precisely because, as Kent sai
Guba Castro wrote:
> Hello,
>
> I recently started teaching myself Python with Michael Dawson's 'Python
> Programming for the Absolute Beginner'.
>
> My problem is that I am running Python 2.5 under Linux while the book is
> based on Python 2.2.3. Apparently this means that I cannot just follow
>
egards,
Robert
>From: Luke Paireepinart <[EMAIL PROTECTED]>
>To: Moedeloos Overste <[EMAIL PROTECTED]>
>CC: tutor@python.org
>Subject: Re: [Tutor] Newbie question: random.sample illusion?
>Date: Thu, 07 Dec 2006 12:17:23 -0600
>
>Moedeloos Overste wrote:
>>Hi eve
Moedeloos Overste wrote:
> Hi everybody,
>
> I'm in the process of learning Python and working my way through O'Reilly's
> "Learning Python". As an excercise I wrote (some copy/paste as well) a small
> lottery program just to learn how to work with lists and dictionarys etc.
>
> The user has to e
Moedeloos Overste wrote:
> Hi everybody,
>
> I'm in the process of learning Python and working my way through O'Reilly's
> "Learning Python". As an excercise I wrote (some copy/paste as well) a small
> lottery program just to learn how to work with lists and dictionarys etc.
>
> The user has to e
> strgOutput=",".join(str(i) for i in LotNumbers) #??converting list
> to string to store it.
note that here, you are *not* converting the list to a string to store
it. you are converting each list member to a string and creating a
new "list" (actually generator [expression]) for the st
"Moedeloos Overste" <[EMAIL PROTECTED]> wrote
> One question: When I run the program from IDLE it writes the data to
> file
> but when I run it from the command prompt(win32) it doesn't. why is
> this?
How do you know? Have you searched for the file?
Or are you looking in the same file that ID
string to file
fout.close()
vDraws = vDraws - 1
>From: "Andreas Kostyrka" <[EMAIL PROTECTED]>
>Reply-To: "Andreas Kostyrka" <[EMAIL PROTECTED]>
>To: "Moedeloos Overste" <[EMAIL PROTECTED]>
>CC: tutor@python.org
>Subje
Hi,
I am not sure what 'random' does (what package is it from?), but
list=['1','2','3']
slist=','.join(list)
works, while
list=[1,2,3]
slist=','.join(list)
does not. It appears 'join' only works on lists (and maybe tuples?) of
string objects and the list must be passed in as an argument. Tr
",".join(str(x) for x in intList)
Andreas
_ Ursprüngliche Mitteilung _
Betreff:[Tutor] Newbie question: join() string method
Autor: "Moedeloos Overste" <[EMAIL PROTECTED]>
Datum: 27. November 2006 13:20:41
Hi,
I'm trying to use the join() method on a list to be able to
Josh Adams wrote:
> Thanks for your help. That makes a lot more sense.
>
> Not to ask too many stupid questions, but why does the L2 assignment in the
> if-block create a new L variable? Shouldn't the scope from the function
> definition dominate the inner scope of the if-block?
It doesn't cr
Thanks for your help. That makes a lot more sense.
Not to ask too many stupid questions, but why does the L2 assignment in the
if-block create a new L variable? Shouldn't the scope from the function
definition dominate the inner scope of the if-block?
Thanks,
Josh
> Josh,
>
> If you print t
Hello Josh,you wrote a different problem. The tutorial should be like this:
Important warning: The default value is evaluated only once.
This makes a difference when the default is a mutable object such as a
list, dictionary, or instances of most classes. For example, the
following function accum
Thats fine, but what differance does it make?I can see no way that it improves the code.I assume later on when the function is called, it should look as follows:move = ask_number("Where will you move? (0-8): ", 0, NUM_SQUARES, 1)
JonOn 01/02/06, Ed Singleton <[EMAIL PROTECTED]> wrote:
On 31/01/06,
On 31/01/06, Jon Moore <[EMAIL PROTECTED]> wrote:
> Improve the function ask_number() so that the function can be called with a
> step value. Make the default value of step 1.
>
> The function looks like this:
>
> def ask_number(question, low, high):
> """Ask for a number within the range"""
>
> Are you the author of Learn to Program Using Python: A Tutorial for
> Hobbyists, Self-starters and All Who Want to Learn the Art of Computer
> Programming?
Yes.
> Is the book still available as a web site?
Yes. It has been substantially rewritten sionce the book was done to
cover more recent
AlanAre you the author of Learn to Program Using Python: A Tutorial for Hobbyists, Self-starters and All Who Want to Learn the Art of Computer Programming?
Is the book still available as a web site?JonOn 31/01/06, Alan Gauld <[EMAIL PROTECTED]
> wrote:> So a general recommendation to authors is to
DannyMany thanks for that, I notice a few erratas that I am yet to come up against. This will save my sanity (well some of it)1JonOn 31/01/06,
Danny Yoo <[EMAIL PROTECTED]> wrote:
On Tue, 31 Jan 2006, Jon Moore wrote:> I have been looking for contact details for the author to ask him what> he was
> So a general recommendation to authors is to have a member of the target
> audience "test" the book. You Jon have done that but at some cost to you
> and those of us on this list.
One advantage of doing my book as a web site first was that I had plenty
of testers before committing to print (ov
On Tue, 31 Jan 2006, Jon Moore wrote:
> I have been looking for contact details for the author to ask him what
> he was eluding to with the exercise, but to no avail.
Hi Jon,
I did find errata here:
http://www.muskalipman.com/ptr_detail.cfm?group=Programming&all=1&isbn=1-59200-073-8
(bottom
I know. Its hard enough for someone like me as it is without things like this complicating it!I have another one for the group, but I will save it for another day ;)I have been looking for contact details for the author to ask him what he was eluding to with the exercise, but to no avail.
JonOn 31/
Jon Moore wrote:
> Hi,
>
> I am still working my way through my 'Python for absolute beginners
> book' and have hit a brick wall with one of the end of chapter exercises.
>
> The challenge says:
>
> Improve the function ask_number() so that the function can be called
> with a step value. Make the
I guess I am not going mad then!I will skip this exercise and move on.ThanksJonOn 31/01/06, Alan Gauld <
[EMAIL PROTECTED]> wrote:Hi Jon,> Improve the function ask_number() so that the function can be called with
> a> step value. Make the default value of step 1.If its any consolation that doesn't
Hi Jon,
> Improve the function ask_number() so that the function can be called with
> a
> step value. Make the default value of step 1.
If its any consolation that doesn't really mean much to me either.
I understand the concept of step value - range() takes one for
example, check the docs.
But
Jon Moore wrote:
> Hi,
>
> I am still working my way through my 'Python for absolute beginners
> book' and have hit a brick wall with one of the end of chapter exercises.
>
> The challenge says:
>
> Improve the function ask_number() so that the function can be called
> with a step value. Make
Title: Message
Ooer, weird keystrokes... my apologies
Bob.
>This is preferred, since any
exception traceback will remain visible.
That's a really good
point... I believe associating a Python batch file using pause
would allow tracebacks to remain also.
@echo
off
c:\Python24\Python
%1
ss enter to run the
script.
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of bobSent:
Wednesday, 23 November 2005 10:44 a.m.To: Liam Clarke-Hutchinson;
'Douglass, Erik'; 'tutor@python.org'Subject: Re: [Tutor] Newbie
question
At 12:20 PM 11/22/2005, Liam Clark
At 12:20 PM 11/22/2005, Liam Clarke-Hutchinson wrote:
Hi
Eric,
Either -
add this line to the end of your scripts
-
discard = raw_input("Press enter to finish.")
Or -
Click on Start > Run... type cmd.exe and
use DOS to move to the directory where your scripts are stored and run
them via
Hello, Erik,
Welcome to the maillist.
>From your description, is sounds like you are attempting to run the
scripts by double clicking on them from Windows Explorer, or from the
Run dialog on the Start menu. Both these methods open a command window
in a new process, run the script, then termina
Title: Message
Hi
Eric,
Either
-
add
this line to the end of your scripts -
discard = raw_input("Press enter to finish.")
Or -
Click
on Start > Run... type cmd.exe and use DOS to move to the directory where
your scripts are stored and run them via Python there.
It's
not trivi
On Tue, 22 Nov 2005, Douglass, Erik wrote:
> I am trying to follow some online first timer tutorials, and I am
> writing the practice scripts in notepad (only w32 at work :-().. I save
> the script with a .py extension, and when I run it it opens for a brief
> moment in a command prompt then cl
* Scott Clausen <[EMAIL PROTECTED]> [051030 16:30]:
> As a newbie to Python I'd like to know if someone can tell me some
> strengths and weaknesses of this language. The reason I'm asking is a
> friend told me I should learn Perl over Python as it's more
> prevalent. I'm going to be using it
If you are interested in learning another tool, please, start with
Python. If you are interested in scripting UNIX, Perl is a fine
choice. There prevalence matters, and quite a bit. But sys admins
are usually very Perl-centric, and in my experience monolingual, and a
bit of an insular community
On 10/31/05, Scott Clausen <[EMAIL PROTECTED]> wrote:
> As a newbie to Python I'd like to know if someone can tell me some
> strengths and weaknesses of this language. The reason I'm asking is a
> friend told me I should learn Perl over Python as it's more
> prevalent. I'm going to be using it on
Hi Scott,
Scott Clausen wrote on 30.10.2005:
>As a newbie to Python I'd like to know if someone can tell me some
>strengths and weaknesses of this language. The reason I'm asking is
>a friend told me I should learn Perl over Python as it's more
>prevalent. I'm going to be using it on a Mac.
>
>I
> friend told me I should learn Perl over Python as it's more
> prevalent. I'm going to be using it on a Mac.
In that case you should switch to a PC because they are more prevalent.
Also you should learn to program in COBOL since its the most prevalent
of all computer languages.
And yet most fol
Scott Clausen wrote:
> As a newbie to Python I'd like to know if someone can tell me some
> strengths and weaknesses of this language. The reason I'm asking is a
> friend told me I should learn Perl over Python as it's more
> prevalent. I'm going to be using it on a Mac.
http://wiki.pytho
> def square(y):
>return y * y
>
> for x in range(1, 11):
>print square(x),
>
> print
>
> Well, I understood the code above. My question is: Is
> it really necessary I have the last "print" statment
No, it just creates a blank line which makes it easier to separate
the output of the pr
Thank you Brian for making the point that I did such a poor job of
conveying. My post did indeed fail to clearly and concisely answer the
question.
Lee C
On Apr 18, 2005, at 11:34 PM, Brian van den Broek wrote:
Lee Cullens said unto the world upon 2005-04-18 21:07:
That just gives you a spacer
Lee Cullens said unto the world upon 2005-04-18 21:07:
That just gives you a spacer line after your output. To see such as a
separator change it to print '*'*10
On Apr 18, 2005, at 8:55 PM, Hoffmann wrote:
Hi All:
I am a newbie, and I am enjoying to study Python a
lot. I have a question about a
That just gives you a spacer line after your output. To see such as a
separator change it to print '*'*10
On Apr 18, 2005, at 8:55 PM, Hoffmann wrote:
Hi All:
I am a newbie, and I am enjoying to study Python a
lot. I have a question about an example I got from one
of my books.
The program is:
d
Adriaan Louw wrote:
I want to learn python as quick as possible, for web programming at
first, and applications later on. Any leads?
There are many tutorials available, see
http://www.python.org/doc/Intros.html for one list.
I have an xp windows and ms office machine. (I'm considering linux, bu
On Fri, 28 Jan 2005 09:42:07 +0200, Adriaan Louw
<[EMAIL PROTECTED]> wrote:
> I want to learn python as quick as possible, for web programming at first,
> and applications later on. Any leads?
Hi,
I'd start with the basic python tutorials, then have a look at
something like CherryPy (http://www
> How can I do it with several variables?
> I = "John"
> print "%s used to love pizza" % I
wrap them in parens:
>>> a,b = 3,4
>>> print "%d x %d = %d" % (a,b, a*b)
> About 10 or more...
Same technique but you might find it easier to use labels to
identify the fields.
>>> sum = a+b
>>> print
a = "foo"
b = "bar"
c = "duck"
print "I will say only this - %s to your %s and no %s" % (a, b, c)
I will say only this - foo to your bar and no duck
And so forth.
On Tue, 15 Feb 2005 19:07:56 +0900, ì ìì <[EMAIL PROTECTED]> wrote:
> How can I do it with several variables?
>
> I = "John"
> pr
79 matches
Mail list logo