Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #65594 > unrolled thread

Re: Python 2.7.6 help with white spaces?

Started byChris Angelico <rosuav@gmail.com>
First post2014-02-07 16:06 +1100
Last post2014-02-07 16:06 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Python 2.7.6 help with white spaces? Chris Angelico <rosuav@gmail.com> - 2014-02-07 16:06 +1100

#65594 — Re: Python 2.7.6 help with white spaces?

FromChris Angelico <rosuav@gmail.com>
Date2014-02-07 16:06 +1100
SubjectRe: Python 2.7.6 help with white spaces?
Message-ID<mailman.6482.1391749612.18130.python-list@python.org>
On Fri, Feb 7, 2014 at 4:01 PM, Scott W Dunning <swdunning@cox.net> wrote:
> Oops, thought you said turning a str into an int.  Yeah, I’m actually using Idle on a mac.  I keep trying differnt things but, I’m just very new to this.
>
> Is this what you’re talking about?
>
> minutes=3
> seconds=11
>
> print str(minutes) + ‘:’ + str(seconds)
>
> Unfortunately I keep getting an error.  Also, not really clear on the reasoning behind changing the int to a string?

Here's another fundamental of Python: Error messages are really REALLY
useful. In this case, I can figure out what's going on without seeing
it, but normally, post the whole traceback. The problem here is
because you're using "smart quotes" of some sort. Use ordinary
apostrophes and double quotes, and it'll work fine.

As to the reason for changing the int to a string... try skipping it!
Then you'll know. You'll get a nice tidy error, pointing you to the
exact cause of the problem.

>>> print minutes + ':' + seconds

See what happens!

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web