Re: Newbie string questions

2011-05-25 Thread Matty Sarro
Thanks guys! I appreciate it. I was wondering why %r was always showing things enclosed in single-quotes. On Wed, May 25, 2011 at 9:13 AM, Chris Guidry wrote: > On Wednesday, May 25, 2011 9:06:02 AM UTC-4, Matty Sarro wrote: >> can't seem to find some of the items in the documentation. Right now

Re: Newbie string questions

2011-05-25 Thread Chris Guidry
On Wednesday, May 25, 2011 9:06:02 AM UTC-4, Matty Sarro wrote: > can't seem to find some of the items in the documentation. Right now > what is stumping me... what exactly does %r do? I can't find it in the > documentation anywhere. Matty, %r in a format string is very much like %s. %s calls str

Re: Newbie string questions

2011-05-25 Thread Chris Angelico
On Wed, May 25, 2011 at 11:06 PM, Matty Sarro wrote: > Right now what is stumping me... what exactly does %r do? You're talking about the formatting operator? It's like the repr function: http://docs.python.org/library/functions.html#repr Chris Angelico -- http://mail.python.org/mailman/listin

Newbie string questions

2011-05-25 Thread Matty Sarro
Hey everyone, This is a super noob question, so please be gentle. I am working my way through "Learn Python the Hard Way" using both python 2.7 and python 3.1 (I want to get a handle on the differences between the two - the intention to write things in python 3 but be able to understand things from

Re: string questions

2007-09-15 Thread J. Cliff Dyer
Marc 'BlackJack' Rintsch wrote: > But please don't use the functions in `string` that are also available as > methods on strings. Those functions are deprecated. > > Meaning (for newbie clarification): instead of string.upper(s2), just do s2.upper(). For more detail, see the docs. -- http

Re: string questions

2007-09-15 Thread Marc 'BlackJack' Rintsch
On Sat, 15 Sep 2007 19:52:47 -0400, Shawn Minisall wrote: > Hi everyone, I'm a beginning programming student in Python and have a > few questions regarding strings. > > If s1 = "spam" > > If s2 = "ni!" > > 1. Would string.ljust(string.upper(s2),4) * 3 start it at the left > margin and move it

string questions

2007-09-15 Thread Shawn Minisall
Hi everyone, I'm a beginning programming student in Python and have a few questions regarding strings. If s1 = "spam" If s2 = "ni!" 1. Would string.ljust(string.upper(s2),4) * 3 start it at the left margin and move it 12 spaces to the right because of the 4 *3? If so, why is it in the parath