[Tutor] Help with converting a string into a integer

bob gailer bgailer at gmail.com
Thu Oct 31 18:18:37 CET 2013


On 10/31/2013 10:11 AM, Carmen Salcedo wrote:
> I'm just trying to figure out how to print the number across like a phone number 555-5555 instead of downward. I'm stuck on that.
>   On further thought:

print "%s%s%s-%s%s%s%s" % tuple(numberList)

The % operator does formatting. Each %s is replaced by the next string 
in the tuple.

Just be sure you have exactly 7 characters in the list or this will fail.

-- 
Bob Gailer
919-636-4239
Chapel Hill NC



More information about the Tutor mailing list