why my code print this when i read and write..

Posted by zjm1126 on Stack Overflow See other posts from Stack Overflow or by zjm1126
Published on 2010-03-22T10:44:32Z Indexed on 2010/03/22 10:51 UTC
Read the original article Hit count: 353

Filed under:
|
def sss(request):
    handle=open('b.txt','r+')
    handle.write("I AM NEW FILE")
    var=handle.read();    
    return HttpResponse(var)

urlpatterns = patterns('',
    ('^$',sss),
)

1.my b.txt has nothing

2.when i run my code ,it print this :

I AM NEW FILE7                                                                                                                                                                                                                                            ??; ??x ??v1?pZ€0  ?????8N??p? ? ?) ? ?`16?? S6??? ?? ?@ ??p?  {?€1?? V ?? @+ ? ? ? ? ???`?   >?) ???@? Z!x`%?p??? ?????@?`7???`? ? ???1X ??????#????€0?(Q??H??P?#? ' ?(5 ?, 7??6H? 0??+??  k%8? `? ??"?`  ?? ?0?? ?????/? ????8S1`?`????0? ?`????? ?? ?? ?????@]?HE,????+?+???p? @O??? ?? 37€P6?7?@= ?? ? ?+xP?x???70? ?????? €???€ h *??x ?1???€K  ? ??8? ??  ?? ?`??   @?? ????? ?€????????8(?P?  ??? p(0B????????? ???? P???? ?/?+?? 9 ? ? ????1???????? ; ?€??€? `?(??? ??+ ??0?? ????6 ?1?,??? {0??? X??€D ??&?€?`? ?H{ ???Xw???? ?? ??0?0?)€Q ?? ?? ? @?????? ?XA6??? O ?0 h ?? ??? ? ? j????0?  57?7@?H+ ??  ? `?? 18? ?P  ??6?0????6?? ?a ?` ????????? pG8s???@ ?  ? (, ? ( ?? ?+&?????7??!0[ 0m ????@??0??????  ??? p?pZ?+?@?€\1?? 0? ?? ??? ?€;?? ??`? ? ? ????*`7?@? 6 R ?????p?????00^#? ??8? h €,h? ? ??x+ ??€37????`+?P?? 1  ? ?????*??6?? ??h: ??83 ? ????0s ????? ?p? ??????"  s?( ??x                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Q s l??x ndies".
    * If value is 1, cand{{ value|pluralize:"y,ies" }} displays "1 candy".
    * If value is 2, cand{{ value|pluralize:"y,ies" }} displays "2 candies".
    u   ,i   u    i   (   RE   RG   R5   R3   R4   (   R    R<   R   t   singular_suffixt
   plural_suffix(    (    s?   D:\Python25\lib\site-packages\django\template\defaultfilters.pyt    pluralize4  s$    

c         C   s   d d k  l } | |  ? S(   sD   Takes a phone number and converts it in to its numerical equivalent.i????(   t
   phone2numeric(   Rc   R   (   R    R 

why?

thanks

© Stack Overflow or respective owner

Related posts about python

Related posts about django