Python论坛  - 讨论区

标题:[python-chinese] How to get a filled string?

2004年03月17日 星期三 13:53

贾利亚 jialia at crtvu.edu.cn
Wed Mar 17 13:53:22 HKT 2004

   '\xff'*length_of_string就可以

======== 2004-03-17 12:00:14 您在来信中写道: ========

如何比较方便的获得"\xff\xff\xff\xff\xff.....\xff\xff"这种很多重复字符的字符串?
我现在的用法是 s = ''.zfill(length_of_string).replace('0', the_sub_string)
可以用,但想知道有没有更直接、更高效的用法?
谢谢!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20040317/4dcef3a3/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2004年03月17日 星期三 14:17

张明义 zhangmingyi at neusoft.com
Wed Mar 17 14:17:23 HKT 2004

应该是'\\xff'*length_of_string
必须对\进行逃逸
  ----- Original Message ----- 
  From: 贾利亚 
  To: python-chinese at lists.python.cn 
  Sent: Wednesday, March 17, 2004 1:53 PM
  Subject: Re: [python-chinese] How to get a filled string?


     '\xff'*length_of_string就可以

  ======== 2004-03-17 12:00:14 您在来信中写道: ========

          如何比较方便的获得"\xff\xff\xff\xff\xff.....\xff\xff"这种很多重复字符的字符串?
          我现在的用法是 s = ''.zfill(length_of_string).replace('0', the_sub_string)
          可以用,但想知道有没有更直接、更高效的用法?
          谢谢!
       





------------------------------------------------------------------------------


  _______________________________________________
  python-chinese list
  python-chinese at lists.python.cn
  http://python.cn/mailman/listinfo/python-chinese
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20040317/d2c0cbba/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2024

    京ICP备05028076号