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

Python3 入门教程

3-8 Python的字符串编码
# coding: utf-8
print('这是一句中英文混合的Python字符串:Hello World!')
2022-09-26 查看完整代码
3-7 Python的字符串format
# Enter a code
template1='life is {s},you need {p}'
short='short'
Python='Python'
result1 =template1.format(s=short,p=Python)
print(result1)

template2='life is {},you need {}'
result2 =template2.format('short','Python')
print(result2)
2022-09-26 查看完整代码
3-6 Python中raw字符串与多行字符串
print(r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.''')
2022-09-26 查看完整代码
3-5 Python的字符串
# Enter a code
a='special string:\',",\\,\\\\,\\n,\\t'
print(a)
2022-09-26 查看完整代码
3-4 Python的布尔类型
# Enter a code
a = 'python'
print('hello,', a or 'world')
b = ''
print('hello,', b or 'world')
2022-09-26 查看完整代码
3-3 Python的整数与浮点数
# Enter a code
num =3.14*1.57
print(round(num,2))
2022-09-26 查看完整代码
3-2 Python定义变量的方法
# Enter a code
hello = 'Hello'
space = ' '
world = 'World'
print(hello, space, world)
2022-09-26 查看完整代码
3-1 Python基础数据类型
# Enter a code
a =3.1415926
b ='Learn Python in imooc'
c = 100
d = 0b1101
print(type(a))
print(type(b))
print(type(c))
print(type(d))
2022-09-26 查看完整代码
2-2 第一个Python程序
# coding=utf-8
print('hello world')
2022-09-26 查看完整代码
首页上一页123下一页尾页
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号