Discuss / Python / 交作业

交作业

Topic source

老帕小帕

#1 Created at ... [Delete] [Delete and Lock User]

print('n = 123') print('f = 456.789') print('s1 = \'Hello, world\'') print('s2 = \'Hello, \\'Adam\\'\'') print('s3 = r\'Hello, \"Bart\"\'') print ('s4 = r\'\'\'Hello, \nLisa!\'\'\'')

豆约卜环

#2 Created at ... [Delete] [Delete and Lock User]

n = 123 print(n) f = 456.789 print(f) s1 = '\'hello,word\'' print(s1) s2 ="'hello,\'Adam\''" print(s2) s3 = "r'hello,\"Bart\"'" print(s3) s4 = "r'''hello,\nLisa!'''" print(s4)

豆约卜环

#3 Created at ... [Delete] [Delete and Lock User]

print("n = 123") print("f = 456.789") print("s1 = 'Hello, world'") print("s2 = 'Hello,\'Adam\''") print("s3 = r'Hello, \"Bart\"'") print("s4 = r'''Hello,\nLisa!'''")

我重新把你的代码修改了一下同学

里面的很多 \' \' \' 都可以把 \ 删除的 因为在如果 ' 本身也是一个字符,那就可以用 "" 括起来 除非""里面还有"的话需要\ 新手互帮互助!


  • 1

Reply