2004年09月24日 星期五 10:15
Levin Du,您好! 奇怪啊!怎么直接敲a和print a会不一样,双斜杆变成了单斜杆了? ======= 2004-09-24 09:45:29 您在来信中写道:======= >呵,格式化输出而已 > >>>> a="\\"+"abc"+"\\"+"def"+ "\\" + "ghi" >>>> a >'\\abc\\def\\ghi' >>>> print a >\abc\def\ghi > > >On Fri, 24 Sep 2004 09:19:18 +0800, Eric Luo <eric.python at gmail.com> wrote: >> >>> s = ["abc", "def", "hit"] >> >>> print '\\'.join(s) >> abc\def\hit >> 不知道你要的是不是这个? >> >> >> On Fri, 24 Sep 2004 09:04:20 +0800, charles huang <hyy at fjii.com> wrote: >> > python-chinese,您好! >> > 诸位大侠,如何把一个几个字符用"\"连起来? >> > 比如:有 "abc" "def" "hig" 三个字符串,如何连成 "\abc\def\hig" >> > 很难办啊! >> > >> > 致 >> > 礼! >> > >> > >> > charles huang >> > >> > >> > >> > _______________________________________________ >> > python-chinese list >> > python-chinese at lists.python.cn >> > http://python.cn/mailman/listinfo/python-chinese >> > >> > >> > >> >> >> _______________________________________________ >> python-chinese list >> python-chinese at lists.python.cn >> http://python.cn/mailman/listinfo/python-chinese >> >_______________________________________________ >python-chinese list >python-chinese at lists.python.cn >http://python.cn/mailman/listinfo/python-chinese = = = = = = = = = = = = = = = = = = = = 致 礼! charles huang hyy at fjii.com TEL: 0591-3333169-212 2004-09-24
2004年09月24日 星期五 10:51
哈,看看这个: >>> a="\\a" >>> print a.__str__() \a >>> print a.__repr__() '\\a' 直接敲a,会调用print a.__repr__() 两个函数 __str__ 和 __repr__ 的区别请参见文档:) On Fri, 24 Sep 2004 10:15:53 +0800, charles huang <hyy at fjii.com> wrote: > Levin Du,您好! > > 奇怪啊!怎么直接敲a和print a会不一样,双斜杆变成了单斜杆了? > > ======= 2004-09-24 09:45:29 您在来信中写道:======= > > > > >呵,格式化输出而已 > > > >>>> a="\\"+"abc"+"\\"+"def"+ "\\" + "ghi" > >>>> a > >'\\abc\\def\\ghi' > >>>> print a > >\abc\def\ghi > > > > > >On Fri, 24 Sep 2004 09:19:18 +0800, Eric Luo <eric.python at gmail.com> wrote: > >> >>> s = ["abc", "def", "hit"] > >> >>> print '\\'.join(s) > >> abc\def\hit > >> 不知道你要的是不是这个? > >> > >> > >> On Fri, 24 Sep 2004 09:04:20 +0800, charles huang <hyy at fjii.com> wrote: > >> > python-chinese,您好! > >> > 诸位大侠,如何把一个几个字符用"\"连起来? > >> > 比如:有 "abc" "def" "hig" 三个字符串,如何连成 "\abc\def\hig" > >> > 很难办啊! > >> > > >> > 致 > >> > 礼! > >> > > >> > > >> > charles huang > >> > > >> > > >> > > >> > _______________________________________________ > >> > python-chinese list > >> > python-chinese at lists.python.cn > >> > http://python.cn/mailman/listinfo/python-chinese > >> > > >> > > >> > > >> > >> > >> _______________________________________________ > >> python-chinese list > >> python-chinese at lists.python.cn > >> http://python.cn/mailman/listinfo/python-chinese > >> > >_______________________________________________ > >python-chinese list > >python-chinese at lists.python.cn > >http://python.cn/mailman/listinfo/python-chinese > > = = = = = = = = = = = = = = = = = = = = > > 致 > 礼! > > > charles huang > hyy at fjii.com > TEL: 0591-3333169-212 > 2004-09-24 > > > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > > >
Zeuux © 2025
京ICP备05028076号