摘要: 阅读全文
posted @ 2019-07-01 17:16 千钧蚁 阅读(105) 评论(0) 推荐(0)
摘要: import socket #创建客户端client=socket.socket() #生成socket连接对象client.connect("localhost",6969) #与目标主机建立连接client.send("hello,world",encode()) #向对方发送消息,转换成二进制 阅读全文
posted @ 2019-07-01 16:27 千钧蚁 阅读(243) 评论(0) 推荐(0)
摘要: pwd="123456"if len(pwd)<8: ex= Exception("密码不能低于8位数!")#自定义异常 raise ex #抛出自定义的异常else: print("密码设置成功") 阅读全文
posted @ 2019-07-01 10:58 千钧蚁 阅读(266) 评论(0) 推荐(0)
摘要: a=[21,32,43,0,32,"a"]for i in a:#取出元素 try:#写可能会报错的代码 print(3/i) except Exception as e:#捕获try异常e print("出现错误,错误是:",e)#出现异常的语句 else: print("......正常.... 阅读全文
posted @ 2019-07-01 10:51 千钧蚁 阅读(185) 评论(0) 推荐(0)
摘要: import tushareimport timedef getdata(share): data=tushare.get_realtime_quotes(share.code) share.name=data.loc[0][0] share.price=float(data.loc[0][3]) 阅读全文
posted @ 2019-07-01 00:25 千钧蚁 阅读(955) 评论(0) 推荐(0)