2005年06月22日 星期三 16:12
   嗯,解决了,呵呵。原来是在用的这台机子的UE设置了自动回车转换,晕。
>   刚才在另一台计算机上试验,竟然是没问题的,看来是我用的机子的问题,跟python没有关系了,可是怎么在这台计算机上会这样,头痛中...
>
>>python-chinese, 您好!
>>
>>    今天遇到一个非常基本的问题,实在是想不通。
>>    在python中,希望写入一些数据,代码如下:
>>f = open("test", "wb")
>>f.write("12\x0a34")
>>f.close()
>>
>>    然后用UE打开看,文件内容是31 32 0d 0a 33 34,实在想不明白,我期望的是31 32 0a 33 34,文件也是以"wb"方式打开的,可是为何还会添加0d。
>>
>>    有那位高手知道如何解决这个问题,呵呵。
>>					 
>>        ouli
>>        ouli at eastcom.com
>>          2005-06-22
>>
>>
>>
>>
>>_______________________________________________
>>python-chinese list
>>python-chinese at lists.python.cn
>>http://python.cn/mailman/listinfo/python-chinese
>>.
>
>        ouli
>        ouli at eastcom.com
>          2005-06-22
>
>
>
>_______________________________________________
>python-chinese list
>python-chinese at lists.python.cn
>http://python.cn/mailman/listinfo/python-chinese
>.
				 
        ouli
        ouli at eastcom.com
          2005-06-22
2005年06月22日 星期三 16:18
原来我也想说是不是ue的问题,但一想你在别的机器上也是使用的ue就没有发信,看到ue的功能太强大了,连个提示都没有啊。 在 05-6-22,ouli<ouli at eastcom.com> 写道: > > 嗯,解决了,呵呵。原来是在用的这台机子的UE设置了自动回车转换,晕。 > > > 刚才在另一台计算机上试验,竟然是没问题的,看来是我用的机子的问题,跟python没有关系了,可是怎么在这台计算机上会这样,头痛中... > > > >>python-chinese, 您好! > >> > >> 今天遇到一个非常基本的问题,实在是想不通。 > >> 在python中,希望写入一些数据,代码如下: > >>f = open("test", "wb") > >>f.write("12\x0a34") > >>f.close() > >> > >> 然后用UE打开看,文件内容是31 32 0d 0a 33 34,实在想不明白,我期望的是31 32 0a 33 34,文件也是以"wb"方式打开的,可是为何还会添加0d。 > >> > >> 有那位高手知道如何解决这个问题,呵呵。 > >> > >> ouli > >> ouli at eastcom.com > >> 2005-06-22 > >> > >> > >> > >> > >>_______________________________________________ > >>python-chinese list > >>python-chinese at lists.python.cn > >>http://python.cn/mailman/listinfo/python-chinese > >>. > > > > ouli > > ouli at eastcom.com > > 2005-06-22 > > > > > > > >_______________________________________________ > >python-chinese list > >python-chinese at lists.python.cn > >http://python.cn/mailman/listinfo/python-chinese > >. > > ouli > ouli at eastcom.com > 2005-06-22 > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > -- I like python! My Donews Blog: http://www.donews.net/limodou New Google Maillist: http://groups-beta.google.com/group/python-cn
2005年06月22日 星期三 16:26
Qutr£¬ÄúºÃ£¡ ¡¡¡¡Õâ¸öÍøÕ¾Ôõô½øÈë°¡? µã»÷½øÈëºó ³öÏÖÒ»¸öͼƬ,È»ºóÈÃÎÒÐÞ¸ÄÍøÖ·. ÄÜÖ¸µãÒ»ÏÂÂð? ======== 2005-06-22 12:14:09 ÄúÔÚÀ´ÐÅÖÐдµÀ£º ======== ¢ÀÚ£¬ÄãºÃ http://www.pythonchallenge.com/ Qutr£¬ qutianrang at gmail.com 2005-6-22 ----- ÊÕµ½ÒÔÏÂÀ´ÐÅÄÚÈÝ ----- ·¢¼þÈË: ¢ÀÚ ÊÕ¼þÈË: python-chinese ʱ ¼ä: 2005-06-22, 11:50:21 Ö÷ Ìâ: [python-chinese] pythonÁ·Ï° ËÆºõÓиöѧϰpythonµÄÍøÕ¾£¬Ìṩ´óÁ¿pythonÁ·Ï°Ì⣬¾ÍºÃÏñÓÎÏ·¹ý¹ØÒ»Ñù£¬´ð°¸ÕýÈ· ²ÅÄܼÌÐø£¬ÄǸöÍøÕ¾µÄÍøÖ·ÍüµôÁË£¬¸÷λÈôÖªÏþ£¬Íû¸æÖª£¬²»Ê¤¸Ðл£¡ _______________________________________________ python-chinese list python-chinese at lists.python.cn http://python.cn/mailman/listinfo/python-chinese = = = = = = = = = = = = = = = = = = = = = = ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡alen_v ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡alen_v at tom.com ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2005-06-22 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050622/c8d1af4d/attachment.htm
2005年06月23日 星期四 19:21
以下两个程序文件看不出有什么不同,但只有一个能运行,不解,请教!不胜感激!
程序A:
#!/usr/bin/python
# Filename:TestCheckUtil.py
from unittest import *
class CheckUtilTest(TestCase):
    def setUp(self):
        pass
    def tearDown(self):
        pass
    def testExample(self):
        self.assertEqual(len("abc"), 3)
if "__main__" == __name__:
    import unittest
    unittest.main()
以上程序不能运行,错误如下:
.E
======================================================================
ERROR: str(object) -> string
----------------------------------------------------------------------
TypeError: 'str' object is not callable
----------------------------------------------------------------------
Ran 2 tests in 0.000s
FAILED (errors=1)
程序B:
#!/usr/bin/python
# Filename:TestCheckUtil.py
import unittest
class CheckUtilTest(unittest.TestCase):
    def setUp(self):
        pass
    def tearDown(self):
        pass
    def testExample(self):
        self.assertEqual(len("abc"), 3)
if "__main__" == __name__:
    unittest.main()
以上程序运行成功,显示如下:
#!/usr/bin/python
# Filename:TestCheckUtil.py
import unittest
class CheckUtilTest(unittest.TestCase):
    def setUp(self):
        pass
    def tearDown(self):
        pass
    def testExample(self):
        self.assertEqual(len("abc"), 3)
if "__main__" == __name__:
    unittest.main()
2005年06月23日 星期四 22:12
¢ÀÚ wrote:
> ÒÔÏÂÁ½¸ö³ÌÐòÎļþ¿´²»³öÓÐʲô²»Í¬£¬µ«Ö»ÓÐÒ»¸öÄÜÔËÐУ¬²»½â£¬Çë½Ì!²»Ê¤¸Ð¼¤£¡
> 
> ³ÌÐòA:
> #!/usr/bin/python
> # Filename:TestCheckUtil.py
> 
> from unittest import *
> 
> class CheckUtilTest(TestCase):
> 
>     def setUp(self):
>         pass
> 
>     def tearDown(self):
>         pass
> 
>     def testExample(self):
>         self.assertEqual(len("abc"), 3)
> 
> if "__main__" == __name__:
>     import unittest
>     unittest.main()
> ÒÔÉϳÌÐò²»ÄÜÔËÐУ¬´íÎóÈçÏ£º
> .E
> ======================================================================
> ERROR: str(object) -> string
> ----------------------------------------------------------------------
> TypeError: 'str' object is not callable
> 
> ----------------------------------------------------------------------
> Ran 2 tests in 0.000s
> 
> FAILED (errors=1)
[snip working code]
unittest.main()µÄ¹¦ÄÜÊÇÔËÐÐÔÚµ±Ç°Ä£¿éÖж¨ÒåµÄËùÓÐTestCase¡£ÄãʹÓÃ
from unittest import *ºó£¬ÔÚµ±Ç°Ä£¿é(__main__)µÄµÄÃû×Ö¿Õ¼äÖоÍÓÐÁËÁ½¸ö
TestCaseÀࣺһ¸öÊÇÄ㶨ÒåµÄCheckUtilTest£¬´ÓTestCaseÅÉÉú£»ÁíÒ»¸öÔòÊÇ
TestCase×ÔÉí¡£
ÄãµÄÔËÐнá¹û".E"±íÃ÷ÔËÐÐÁËÁ½¸öTestCase£¬Ò»¸ö³É¹¦ÁË£¬Ò»¸öʧ°ÜÁË¡£ÄǸöʧ°Ü
µÄ¾ÍÊÇTestCaseÕâ¸ö»ùÀà¡£
-- 
Qiangning Hong
 __________________________________________________________
( I don't believe there really IS a GAS SHORTAGE.. I think )
( it's all just a BIG HOAX on the part of the plastic sign )
( salesmen -- to sell more numbers!!                       )
 ----------------------------------------------------------
    o
     o
      o
  ___       _____     ___
 /   \     /    /|   /   \
|     |   /    / |  |     |
|     |  /____/  |  |     |
|     |  |    |  |  |     |
|     |  | {} | /   |     |
|     |  |____|/    |     |
|     |    |==|     |     |
|      \___________/      |
|                         |
|                         |
Zeuux © 2025
京ICP备05028076号