为了账号安全,请及时绑定邮箱和手机立即绑定
课程 \ Python3 入门教程(新版)

Python3 入门教程(新版)

3-8 Python的字符串编码
# coding: utf-8
s1 = '这是中文字符串'
s2 = 'this is an English string'
print(s1)
print(s2)
2020-11-22 查看完整代码
3-7 Python的字符串format
template = 'Hello {3}, Hello {2}, Hello {1}, Hello {0}.'
result = template.format('World', 'China', 'Beijing', 'imooc')
print(result)
2020-11-22 查看完整代码
3-6 Python中raw字符串与多行字符串
# Enter a code
print(r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.''')

print('\"To be, or not to be\": that is the question.\nWhether it\'s nobler in the mind to suffer.')
2020-11-21 查看完整代码
3-5 Python的字符串
s = 'special string: \', ", \\, \\\\, \\n, \\t'
print(s)
2020-11-21 查看完整代码
3-4 Python的布尔类型
# Enter a code
a = 'python'
print('hello,', a or 'world')
b = ''
print('hello,', b or 'world')
2020-11-21 查看完整代码
3-3 Python的整数与浮点数
# Enter a code
print(10/3.0)
2020-11-21 查看完整代码
3-2 Python定义变量的方法
# Enter a code
a=1
hello = "hello"
print(hello)
2020-11-21 查看完整代码
3-1 Python基础数据类型
# Enter a code
0.1+0.2
2020-11-21 查看完整代码
2-2 第一个Python程序
# coding=utf-8
print("haha")
2020-11-21 查看完整代码
意见反馈 帮助中心 APP下载
官方微信