栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Python第一天作业

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Python第一天作业

1.定义变量:

int_sun = 1
int_sun = int(1)
print(int_sun, type(int_sun))
float_sun = 2.1
float_sun = float(2.1)
print(float_sun, type(float_sun))
complex_sun = 2 + 5j
complex_sun = complex(2, 5)
print(complex_sun, type(complex_sun))
bool_sun = True
bool_sun = False
bool_sun = bool()
bool_sun = bool(True)
bool_sun = bool(False)
print(bool_sun, type(bool_sun))
bytes_sun = b"45"
bytes_sun = bytes(45)
print(bytes_sun, type(bytes_sun))
str_sun = "sun yi tong"
str_sun = str("sun yi tong")
print(str_sun, type(str_sun))
str_sun = str(153)
print(str_sun, type(str_sun))
tuple_sun = (1, 2, 3, 4)
print(tuple_sun, type(tuple_sun))
tuple_sun = tuple()
print(tuple_sun, type(tuple_sun))
tuple_sun = (15, 5.2, True, "string", bytes, None)
print(tuple_sun, type(tuple_sun))


2.list列表:
第一种:Ctrl+鼠标左键 选择 即可得到list源码

第二种:help(XX)即可得到源码

3.字节和字符串转换:

sun = bytes("鸥鹏", encoding='UTF-8')
print(sun, type(sun))
sun1 = sun.decode(encoding='UTF-8')
print(sun1)


4.print函数使用:

print('Hello', end='&')
print('你好', end='&')
print('Bye', end='&')
print('This is Ending')


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/323708.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号