如何在python中执行此操作?

时间:2019-03-04 08:45:18

标签: python-3.x string unicode-escapes

这是vb6代码

Dim i As Long, mystr As String

For i = 0 To 9

    mystr = mystr & "\u000" & i & vbCrLf

Next

Me.Text1.Text = mystr

输出必须为:

\ u0000

\ u0001

\ u0002

\ u0003

\ u0004

\ u0005

\ u0006

\ u0007

\ u0008

\ u0009

1 个答案:

答案 0 :(得分:0)

mystr = ''
for i in range(10):
   mystr = mystr + '\\u000' + str(i) + '\n'

print(mystr)