demo02
2015-10-13 10:08
316 查看
class PhoneNumber(): def __init__(self,number): self.a=number[1:4] self.b=number[6:9] self.c=number[10:14] def __str__(self): return "(%s) %s-%s"%(self.a,self.b,self.c) def test(): print #newNumber=raw_input("Enter phone number in the form. (123) 456-7890: \n") #phone=PhoneNumber(newNumber) #print "The phone number is:",phone if __name__=="__main__": test()
相关文章推荐
- HttpClient容易忽视的细节——连接关闭,使用不当服务器会出现大量的Close_Wait现象
- 1588: [HNOI2002]营业额统计
- 修改MAC过程
- stl之map容器的原理及应用
- python之函数用法__str__()
- 分享一个不错的mysql语句
- Tomcat 启动时 There is no Action mapped for namespace [/] and action name [] associated with context pa
- Tomcat 启动时 There is no Action mapped for namespace [/] and action name [] associated with context pa
- Tomcat 启动时 There is no Action mapped for namespace [/] and action name [] associated with context pa
- border-style有哪些值?这些值的作用
- 标准模板库(六):STL算法函数介绍
- VS2013常用快捷键
- C++中的顶层const和底层const
- 数据结构复习1——链表反转
- poj 1426
- UISearchController
- 017redis3.0集群部署
- Android性能专项测试之battery-historian试用
- mongoDB——前序(NoSQL)
- springMVC的视图层解析与服务层调用