更正,C中的'\a'是响铃符,主板喇叭发声(有些笔记本主板不会发声);'\r'是回车符,一般会造成光标回到行首。还有,Windows中是"\r\n"。
在 2011年1月20日 下午4:34,Robot 马 <[email protected]> 写道: > forest > chen说的没错。至于第二个问题,我不记得/a有什么特别的转义....../r的话是"段落符",/n才是换行符,WINDOWS下的一个"回车"其实是/n/r(LINUX下仅有一个/n,老的MAC上是一个/r)。所以如果在WIN或者LIN下的话,/r是不会有显示的。 > > 在 2011年1月20日 下午4:27,forest chen <[email protected]>写道: > >> b 是一个int,你直接把int类型打印成 %c ,就直接打印出其对应的 ASCII值 , 12和1的ASCII值都不是有效字符。 >> >> 2011/1/20 Qi Wang <[email protected]> >> >> > >>> b=12 >> > >>> print ("%c" % b) >> > □ >> > >>> b=1 >> > >>> print ("%c" % b) >> > □ >> > >> > 为什么会出现方框呢? >> > >> > print ("Welcome \a to \r Python!") >> > 得到 >> > Welcome □ to Python! >> > 中的"\a"为什么得到的也是方框 而\r 没有任何效果。 >> > >> > Py新手...... >> > 真诚求教...... >> > >> > ------------------------------------------------------------ >> > Biological science '11, Zhejiang University >> > College of Life Sciences >> > >> > Room 205,Qingxi 1st, Zijingang Campus, Zhejiang University, Hangzhou, >> > 310058, PR China >> > Tel:+86-13732288062 >> > -------------- 下一部分 -------------- >> > 一个HTML附件被移除... >> > URL: < >> > >> https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110120/f153f895/attachment.html >> > > >> > -- >> > ubuntu-zh mailing list >> > [email protected] >> > https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh >> > >> -------------- 下一部分 -------------- >> 一个HTML附件被移除... >> URL: < >> https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110120/e0432a53/attachment.html >> > >> -- >> ubuntu-zh mailing list >> [email protected] >> https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh >> > > > > -- > Robot Shell > http://robotshell.org/ > -------------- 下一部分 -------------- > 一个HTML附件被移除... > URL: > <https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110120/5c1db778/attachment.html> > -- > ubuntu-zh mailing list > [email protected] > https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh > -- ubuntu-zh mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh
