>>> s='Hello, world.'>>> str(s)'Hello, world.'>>> repr(s)"'Hello, world.'">>> str(1/7)'0.14285714285714285'>>> x=10*3.25>>> y=200*200>>> s='The value of x is '+repr(x)+', and y is '+repr(y)+'...'>>> print(s)The value of x is 32.5, and y is 40000...>>> # The repr() of a string adds string quotes and backslashes:... hello='hello, world\n'>>> hellos=repr(hello)>>> print(hellos)'hello, world\n'>>> # The argument to repr() may be any Python object:... repr((x,y,('spam','eggs')))"(32.5, 40000, ('spam', 'eggs'))"
python 打开文件
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 在孩子在刚进入初中时候,朋友跟孩子的亲子关系一度非常恶劣,面对刺猬一般的孩子,靠不拢,贴不近,朋友也无可奈何。 经...