python
文章平均质量分 59
Allen :-)
但行好事,莫问前程
展开
-
[Python]复制文件时报错 UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xff in position 0
在尝试用脚本实现文件内容复制时,出现了Unicode解码错误。错误:PS E:\自学\python\project> echo "This is a test file." > test.txtPS E:\自学\python\project> cat .\test.txtThis is a test file.PS E:\自学\python\project> python .\ex17.py .\test.txt .\new_file.txtCopying from原创 2021-04-29 00:15:42 · 1831 阅读 · 0 评论 -
[Python]ValueError: not enough values to unpack 和 Possible unbalanced tuple unpacking with sequence
项目场景:提示:这里简述项目相关背景:例如:项目场景:示例:通过蓝牙芯片(HC-05)与手机 APP 通信,每隔 5s 传输一批传感器数据(不是很大)问题描述:Traceback (most recent call last): File "E:\自学\python\project\ex13.py", line 3, in <module> script, first, second, third = argv #解包ValueError: not enough v原创 2021-04-27 19:33:58 · 832 阅读 · 0 评论 -
[Python]为何整除也会出现浮点数?
[Python3] 为何整除也会出现浮点数?今天在学习python时发现一个奇怪的问题,#打印不同性别的鸡及数量print("Hens",25+30/6)终端运行结果明明可以整除的两个整数为什么运算结果却是浮点数呢?然后我就分别用除法和取整除法对整数,浮点数进行了实验。代码片段#可以整除的两个整数相除print("6/3 = ",6/3)print("6//3 = ",6//3)#可以整除的两个浮点数相除print("6.0/3 = ",6.0/3)print("6.0//3原创 2021-04-23 14:01:06 · 3878 阅读 · 1 评论