城市里的游牧民族

Menu

Python学习笔记2

Python数据类型和变量
请通过print打印出以下变量的值:

# -*- coding: utf-8 -*-
n = 123
f = 456.789 s1 = 'hello,world'
s2 = 'hello,\'adam\'
s3 = r'hello,"bart"'
s4 = r'''hello,
lisa!'''
print('# -*- coding: utf-8 -*-','\nn = 123','\nf = 456.789',"\ns1 = 'hello,world'","\ns2 = 'hello,\\'adamr\\'","\ns3 = r'hello,\"bart\"'","\ns4 = r'''hello,\nlisa!'''")
# -*- coding: utf-8 -*- 
n = 123 
f = 456.789 
s1 = 'hello,world' 
s2 = 'hello,\'adamr\' 
s3 = r'hello,"bart"' 
s4 = r'''hello,
lisa!'''
— 于 共写了396个字
— 文内使用到的标签:
本作品采用知识共享署名-非商业性使用-禁止演绎 3.0 中国大陆许可协议进行许可。

5条回应:“Python学习笔记2”

  1. catbaron说道:

    另外你代码错的地方还没改

  2. catbaron说道:

    In [1]: s = ‘hello, \’adamr\’
    File “”, line 1
    s = ‘hello, \’adamr\’