I know this is probably a stupid question, but I'm learning Python, and
am trying to get the if function to work with letters/words. Basicly,
I'm trying to write a script that when run, says
Please enter your name:
Then, if the user types myself as the name , the output is OK. Thats
all I want
try:
x = raw_input(Please enter your name: )
--
http://mail.python.org/mailman/listinfo/python-list
Byte wrote:
x = input(raw_input(Please enter your name: ))
if x==myself: print 'OK'
It kinda works - I can get to the please enter your name bit but then
it simply reprints your input as output. Someone please HELP!
--
C:\python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit
Hi Byte!
Your code should look like this:
x = raw_input('Please enter your name: ')
if x == 'myself': print 'OK'
Because myself should be a string and not a variable name, you have to
put it in quotes.
Regards, Florian.
--
http://mail.python.org/mailman/listinfo/python-list
Florian Nykrin, that works! Thanks!
p.s. Xavier Morel, you seem to be using Windows, not Linux, and I got
the idea of stacking input on a raw_input from the official Python
Tutorial.
--
http://mail.python.org/mailman/listinfo/python-list
On 2/5/06, Ivan Shevanski [EMAIL PROTECTED] wrote:
On 2/5/06, Florian Nykrin [EMAIL PROTECTED]
wrote:
Hi Byte!Your code should look like this:x = raw_input('Please enter your name: ')if x == 'myself': print 'OK'
Because myself should be a string and not a variable name, you have toput it in
On 2/5/06, Ivan Shevanski [EMAIL PROTECTED] wrote:
On 2/5/06, Ivan Shevanski [EMAIL PROTECTED]
wrote:
On 2/5/06, Florian Nykrin [EMAIL PROTECTED]
wrote:
Hi Byte!Your code should look like this:x = raw_input('Please enter your name: ')if x == 'myself': print 'OK'
Because myself should be
Byte wrote:
p.s. Xavier Morel, you seem to be using Windows, not Linux, and I got
the idea of stacking input on a raw_input from the official Python
Tutorial.
link, please.
/F
--
http://mail.python.org/mailman/listinfo/python-list
Use input to enter numbers, and raw_input to enter strings.
For example:
x = input('Enter your age: ')
y = raw_input('Enter your name: ')
--
http://mail.python.org/mailman/listinfo/python-list
Byte wrote:
p.s. Xavier Morel, you seem to be using Windows, not Linux
what makes you think that basic Python functions work in radically
different ways on different platforms ?
/F
--
http://mail.python.org/mailman/listinfo/python-list
what makes you think that basic Python functions work in radically
different ways on different platforms ?
Assumption. Im also new to programing, so could do something stupid
like think a Windows path is a command/input/etc. (really, ive done
things like that before.)
Now, im running this on a
http://docs.python.org/tut/node6.html#SECTION00610
--
http://mail.python.org/mailman/listinfo/python-list
Byte [EMAIL PROTECTED] wrote:
http://docs.python.org/tut/node6.html#SECTION00610
I think you're confusing the tutorial's use of:
int(raw_input(...
which means get a string from the user and turn it into an integer (a
very common idiom), with your use of:
Byte wrote:
p.s. Xavier Morel, you seem to be using Windows, not Linux
I don't see how this may even remotely be relevant, Python is cross
platform and (mostly) works the same regardless of the OS
I got
the idea of stacking input on a raw_input from the official Python
Tutorial.
Byte wrote:
http://docs.python.org/tut/node6.html#SECTION00610
--
x = int(raw_input(Please enter an integer: ))
--
Unless my eyes fail me, it's written int, not input, the goal of
this line is to convert the return value of raw_input (a string) into an
integer.
--
Thanks, never knew that, but they are using raw_input as a stack,
aren't they?
--
http://mail.python.org/mailman/listinfo/python-list
Byte wrote:
Assumption. Im also new to programing, so could do something stupid
like think a Windows path is a command/input/etc. (really, ive done
things like that before.)
Don't assume anything when you have no reason to, and especially don't
assume that a cross-platform programming
Yes, sorry, didnt realise diffrence between int and input. Since i'm
such an idiot at this, any links to sites for people who need an
unessicerily gentle learning curve?
--
http://mail.python.org/mailman/listinfo/python-list
parse the expression, extract the operands and the operation, apply the
operation to the operands
How? Give me some example code, but please keep it simple.
are you trying to code a calculator?
Not intending to, just trying to learn Python. Suppose what i'm trying
to code is a but like a CLI
Byte wrote:
parse the expression, extract the operands and the operation, apply the
operation to the operands
How? Give me some example code, but please keep it simple.
are you trying to code a calculator?
Not intending to, just trying to learn Python. Suppose what i'm trying
to code
I asked to keep it simple! Anyway, ill try Dive into Python, thanks
--
http://mail.python.org/mailman/listinfo/python-list
Byte [EMAIL PROTECTED] wrote:
Thanks, never knew that, but they are using raw_input as a stack,
aren't they?
No. raw_input is a function object, using it as a stack is a rather
meaningless phrase. You can use a list as a stack, but that's totally
and absolutely unrelated to that spot in the
Xavier Morel wrote:
Where the hell did you get the idea of stacking input on a raw_input in
the first place?
I'm guessing it goes something like: input is a verb, but raw_input
is a noun, so raw_input looks like a cast or conversion or stream
constructor, and input looks like an action...
Byte wrote:
Yes, sorry, didnt realise diffrence between int and input. Since i'm
such an idiot at this, any links to sites for people who need an
unessicerily gentle learning curve?
http://wiki.python.org/moin/BeginnersGuide
http://www.honors.montana.edu/~jjc/easytut/easytut/
Byte wrote:
I asked to keep it simple! Anyway, ill try Dive into Python, thanks
It is simple, merely explicit and with some details.
--
http://mail.python.org/mailman/listinfo/python-list
Xavier Morel wrote:
Byte wrote:
I asked to keep it simple! Anyway, ill try Dive into Python, thanks
It is simple, merely explicit and with some details.
It seemed to me a bit like an attempt to save a drowning man by opening
a firehose on his mouth :-)
regards
Steve
--
Steve Holden
On Fri, 2 Feb 2006, [EMAIL PROTECTED] wrote:
silly newbie mistake
your code runs fine on my openbsd box. ( I didnt uncomment the return
map(...) line
My apologies - i should have made it clearer in the comment that it was
hardwired to return example data!
thanks for the awesome example!
hi all,
I have a simple snippet I am trying to keep the format the same as
plain text, though I want to embed it in html ...
basically,
print Content-type:text/plain\n\n;
getrup = os.popen('ruptime').read()
print getrup
is the same format as if I ran 'ruptime' from the command line.
If I
[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
hi all,
I have a simple snippet I am trying to keep the format the same as
plain text, though I want to embed it in html ...
basically,
print Content-type:text/plain\n\n;
getrup = os.popen('ruptime').read()
print getrup
is the
Well, I did want to add some formatting for example
STATUS = up
getrup = os.popen('ruptime').read()
show = getrup.splitlines()
gethost = show[0]
hostname = gethost.split()
print hostname[0]
getstatus = hostname[1]
if getstatus.find(STATUS):
print STATUS
else:
print font
On Thu, 2 Feb 2006, [EMAIL PROTECTED] wrote:
Well, I did want to add some formatting for example
I getcha. This is really an HTML problem rather than a python problem,
isn't it? What you need to do is output a table.
FWIW, here's how i'd do it (assuming you've got HP-UX ruptime, since
that's
thanks tom,
I am running OpenBSD, NetBSD as well as OS X (FreeBSD)
My first python script
#!/usr/local/bin/python
print Content-type:text/html\n\n;
import os, string
getrup = os.popen('ruptime').read()
show = getrup.splitlines()
for line in show:
if line.find(up or down):
Tom, the script you referenced me errored ... But I will see if I can
get it working.
--
http://mail.python.org/mailman/listinfo/python-list
silly newbie mistake
your code runs fine on my openbsd box. ( I didnt uncomment the return
map(...) line
thanks for the awesome example!
--mike
--
http://mail.python.org/mailman/listinfo/python-list
Falc wrote:
Hi there...
I have been looking at learning Python, so far it looks like an
absolutely grat language. I am having trouble finding some free
resources to learn Python from. I am on windows and the only experience
I have with programming is with PHP.
I have been trying to look
Hi there...
I have been looking at learning Python, so far it looks like an
absolutely grat language. I am having trouble finding some free
resources to learn Python from. I am on windows and the only experience
I have with programming is with PHP.
I have been trying to look at the free online
Falc wrote:
So if you have any books you could reccomend me that would rock, I
can't really afford a book so if online that would be excellent.
Have you looked into:
http://wiki.python.org/moin/BeginnersGuide
http://python.org/doc/Intros.html
Cheers,
--
Klaus Alexander Seistrup
Falc wrote:
Hi there...
I have been looking at learning Python, so far it looks like an
absolutely grat language. I am having trouble finding some free
resources to learn Python from. I am on windows and the only experience
I have with programming is with PHP.
I have been trying to look
I am going to read A Byte Of Python and possibly a few others
afterwards. I sure will read Dive into Python.
Thanks a lot guys, it's beed a great help.
I'll buy Learning Python when I can but I'm on a *very* tight budget
at the moment.
Thanks again. :)
--
http://mail.python.org/mailman
Wow, That's one I hadn't seen before. Thanks. bs
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 10 Oct 2005 17:20:35 +, dannypatterso wrote:
[snip]
I'm a hobby programmer using mostly BASIC(s) and some Java. I know
procedural programming and I know what encapsulation, inheritance and
polymorphism are but I have very little experience in using them as
I've written just a
Chris Dewin [EMAIL PROTECTED] writes:
There was an excellent such primer on devshed, by Icarus, but they appear
to have taken it down.
I saved a copy of it to my HD. Would there be anything morally, or legally
wrong with me uploading it to my site?
A little googling shows it's still up at:
These are all great suggestions.
Thanks to all who replied.
paul
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 11 Oct 2005 18:26:58 +0900, Chris Dewin wrote:
On Mon, 10 Oct 2005 17:20:35 +, dannypatterso wrote:
[snip]
I'm a hobby programmer using mostly BASIC(s) and some Java. I know
procedural programming and I know what encapsulation, inheritance and
polymorphism are but I have
I do highly recommend this site, too.
Listen to the python411 podcast shows. It's great.
Jeff Fox wrote:
Lots of links to all levels of tutorials and documentation here:
http://www.awaretek.com/plf.html
Python Podcast too!
--
http://mail.python.org/mailman/listinfo/python-list
Paul DiRezze wrote:
I'm spending the next two weeks off and I'm looking to take a crack at
learning how to program in Python. Here's a list of the places I've
bookmarked:
http://www.python.org/doc/ and more specifically
http://wiki.python.org/moin/
On 2005-10-10 18:50:18 +0200, Paul DiRezze [EMAIL PROTECTED] said:
I'm spending the next two weeks off and I'm looking to take a crack at
learning how to program in Python. Here's a list of the places I've
bookmarked:
http://www.python.org/doc/ and more specifically
I'm spending the next two weeks off and I'm looking to take a crack at
learning how to program in Python. Here's a list of the places I've
bookmarked:
http://www.python.org/doc/ and more specifically
http://wiki.python.org/moin/
http://wiki.python.org/moin/BeginnersGuide
On Mon, 10 Oct 2005 12:50:18 -0400, Paul DiRezze [EMAIL PROTECTED]
wrote:
I'm spending the next two weeks off and I'm looking to take a crack at
learning how to program in Python. Here's a list of the places I've
bookmarked:
http://www.python.org/doc/ and more specifically
I would suggest buying Beginning Python: Novice to Professional, by Magnus
hetland. It is IMO the best Python book written to date. This book this
mailing-list and Python.org are all you should need.
I'm spending the next two weeks off and I'm looking to take a crack at
learning how to
A good introduction to Python is the recently published book Beginning
Python from Novice to Pro. It provides a quick introduction to
Python, skips a lot of the details hard core programmers expect, and
has very few samples of difficult to understand lines of code that can
easily discourage the
This should be good for a couple weeks
http://www.awaretek.com/tutorials.html
http://www.rexx.com/~dkuhlman/python_101/python_101.html
http://www.rexx.com/~dkuhlman/python_201/python_201.html
http://www.ibiblio.org/obp/py4fun/
http://the.taoofmac.com/space/Python/Grimoire
programmer using mostly BASIC(s) and some Java.
I learned from Learning Python from O'Reilly. There's a new
edition out that covers a somewhat more recent version
of Python (2.3, I think).
I learned BASIC as a teen -- Fortran, Pascal, C, and a bit of C++
later, so I think you probably have
Lots of links to all levels of tutorials and documentation here:
http://www.awaretek.com/plf.html
Python Podcast too!
--
http://mail.python.org/mailman/listinfo/python-list
. on-line tutorials?
hundreds of e-books sorted by subtopic
http://www.awaretek.com/tutorials.html
-- Python Newbies should visit our Python411 Podcast Series Page
http://www.awaretek.com/python/index.html
-- Python for Mobile Devices
http://www.awaretek.com/pymo.html
Table of Contents
. need specifics on text or web processing?
dozens of tutors.py sorted by subtopic
http://www.awaretek.com/tutorials.html
Table of Contents [rearranged]
[ beginner`s applications ]:
*Text and String Processing (3)*
. *Unicode (4)*
*Regular Expressions(5)*
*HTML and XML (14)*
*Internet:
If you're already fluent in other programming language(s) [sounds like
you are], then this is decent and available free online:
http://www.diveintopython.org/
placid wrote:
Sometimes when you concentrate on complicated problems your thinking of
a complicated solution and not a simple one.
Hi all,
I was just wondering about good books that teach python (either with
programming or no programming experience at all) ? Or some online
tutorial?
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
placid [EMAIL PROTECTED] writes:
I was just wondering about good books that teach python (either with
programming or no programming experience at all) ? Or some online
tutorial?
Did you even bother doing a web search? Learn Python or Python
tutorial would be enough.
Christopher
--
Christopher Culver wrote:
placid [EMAIL PROTECTED] writes:
I was just wondering about good books that teach python (either with
programming or no programming experience at all) ? Or some online
tutorial?
Did you even bother doing a web search? Learn Python or Python
tutorial would be
placid wrote:
Christopher Culver wrote:
placid [EMAIL PROTECTED] writes:
I was just wondering about good books that teach python (either with
programming or no programming experience at all) ? Or some online
tutorial?
Did you even bother doing a web search? Learn Python or Python
tutorial would
Benji York wrote:
placid wrote:
Christopher Culver wrote:
placid [EMAIL PROTECTED] writes:
I was just wondering about good books that teach python (either with
programming or no programming experience at all) ? Or some online
tutorial?
Did you even bother doing a web search? Learn
Hello,
I am a Java Developer that has been learning Python
by doing simple things. I am loving thisinitial vibeI'mgetting
outof Python. However, because I feel programmers ofa
certainlanguagesbring with them certain vices when moving to other
languages, I'd like to have feedback from
Hello Jorge,
Is there some sort of a Wiki where I could post the code and have
advice on what, how and where to improve? Or should I post the code it
here?
You can always get help here, the Python community is *very* helpful.
If you prefer a Wiki, try www.wikispaces.org for free Wiki
The python tutor good for this
http://mail.python.org/mailman/listinfo/tutor
Miki Tebeka wrote:
Hello Jorge,
Is there some sort of a Wiki where I could post the code and have
advice on what, how and where to improve? Or should I post the code it
here?
You can always get help
A book that will stay useful as a referene *after* you've used it to
learn is 'Programming Python'.
Best Regards,
Fuzzy
http://www.voidspace.org.uk/python
--
http://mail.python.org/mailman/listinfo/python-list
Lennart ha scritto:
Programming Python will I sell as a book that i read secondly, and use as a
reference.
I'd like to suggest also Thinking like a CS in python: a schoolbook
used in real classes to teach the basis of programming.
--
Renato
Usi Fedora? Fai
, but these ones are very good. The first one is
best for someone who knows nothing about programing, and the second one
is probably better for you, since you already have some experience.
It's good for absolute beginners though.
Books:
- Learning Python by Mark Lutz
- Core Python by Wesley Chun
Hi everybody,
Can someone advice me with the following issue: i want to learn python in
my summer vacation (i try to ...:-) So, a good start is buying a good book.
But wich? There are many ...
I'm living in the Netherlands and I prefer a book from bol.com (see link)
because i've to order more
=BOOK_EN%2eCATEGORYSecondary=YESTemplate=BOL_subcat_BOOK_EN_1476
Two excellent books match your criteria:
Dive Into Python (review: http://www.techbookreport.com/tbr0103.html) -
also available as a free download.
Learning Python (review: http://www.techbookreport.com/tbr0064.html)
Both
=HwqR5Kpb8AUAAADqVW6ZypJb
CategoryLeftpanel=BOOK_EN%2eCATEGORYSecondary=YESTemplate=BOL_sub
cat_BOOK_EN_1476
I've taken up learning python over the summer as well.
http://safari.oreilly.com/ is a website which sells IT books for on-line
viewing. They charge $20 per month and you get 10 slots on your
:
Dive Into Python (review: http://www.techbookreport.com/tbr0103.html) -
also available as a free download.
Learning Python (review: http://www.techbookreport.com/tbr0064.html)
Both are recommended for beginners but have a reasonable level of depth.
They're clear, enthusiastic and well
Lennart enlightened us with:
Can someone advice me with the following issue: i want to learn
python in my summer vacation (i try to ...:-) So, a good start is
buying a good book. But wich? There are many ...
http://www.diveintopython.org/ - I read it during the weekend, and
it's a very good
hi,
although Dive into Python is a *very, very* good Python book (I own the
real book) I would not recommend it as your first book to learn
Python. Take a look at Practical Python by Hetland first for instance,
it will teach you all the basic stuff. Then move over to Dive
into Python and also
Hi. What is the best way to learn Python? None of the local schools
near me teach any courses on the topic. Thanks.
--
Cody Houston
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Hi. What is the best way to learn Python? None of the local schools
near me teach any courses on the topic. Thanks.
--
Cody Houston
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
http://mail.python.org/mailman/listinfo/tutor.
A free book that starts very slow (it is aimed at high-school
students) is http://www.ibiblio.org/obp/thinkCSpy/
I started with that, until I had a bit of a sense of things (Python is
my first language since some BASIC quite some time ago). The Learning
(google this).
I learned the basics with it.
Then you can try any of the other resources listed in www.python.org.
If you're willing to buy a book, try Learning Python 2nd.Ed by Mark
Lutz or Core Python by Wesley Chun.
Regards,
Luis
--
http://mail.python.org/mailman/listinfo/python-list
Lisa Horton wrote:
I hear that Python is one of the easiest languages to learn. It is
easier than PHP or Pearl? Is it as useful as those two? I am attracted
to Python as a first language, but I just want to be sure I will be
able to use it.
Opinions, thoughts, thanks!
I suggest grabbing the 2.4
built-in tools for writing, editing and
running programs, good and user-friendly documentation (which appears
to be better organized than Perl´s doc), and a lot of built-in
functions to handle data structures and files in an easily tractable,
easily remembered way. By learning Python, you will also
501 - 580 of 580 matches
Mail list logo