摘要: 1 # -*- coding: utf-8 -* 2 import serial 3 import time 4 # 打开串口 5 ser = serial.Serial("/dev/ttyAMA0", 9600) #"/dev/ttyAMA0"为树莓派串口 win7为com7 6 def main 阅读全文
posted @ 2019-12-06 18:08 做梦者造梦 阅读(891) 评论(0) 推荐(0) 编辑
摘要: 1 #!/usr/bin/python 2 # -*- coding: UTF-8 -*- 3 4 str_1 = input("输入一个字符串:") 5 len1 = len(str_1) - 1 6 str_list = [] 7 while(len1 >= 0): 8 str_list.app 阅读全文
posted @ 2019-12-06 17:58 做梦者造梦 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 1 import time 2 count = 0 3 a = input('time:') 4 b = int(a) * 60 5 while (count < b): 6 ncount = b - count 7 print('%dS'%ncount) 8 time.sleep(1) 9 cou 阅读全文
posted @ 2019-12-06 17:54 做梦者造梦 阅读(3171) 评论(0) 推荐(0) 编辑
摘要: 最新的 Python3.7 中(2018.07.13),对类的构造函数进行了精简。 from dataclasses import dataclass @dataclass class A: x:int y:int def add(self): return self.x + self.y 相当于以 阅读全文
posted @ 2019-12-06 17:45 做梦者造梦 阅读(5232) 评论(0) 推荐(0) 编辑
摘要: 问题描述: 我们用pycharm打开自己写的代码,当多个文件之间有相互依赖的关系的时候,import无法识别自己写的文件,但是我们写的文件又确实在同一个文件夹中 如图:同目录下明明存在相应文件,在导入时却出现带有红色波浪线,说没有相应的模块,但是确实有random_walk文件 解决方法: 打开Fi 阅读全文
posted @ 2019-12-06 16:44 做梦者造梦 阅读(713) 评论(0) 推荐(0) 编辑
摘要: 1 import time 2 import tkinter as tk 3 from tkinter import messagebox 4 5 6 def main(): 7 window1 = tk.Tk() 8 window1.title('计时器【v0.0】') 9 window1.geo 阅读全文
posted @ 2019-12-06 16:33 做梦者造梦 阅读(1652) 评论(0) 推荐(0) 编辑