随笔分类 -  python

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 48 下一页
摘要:qq群:864902439 欢迎加入讨论。 阅读全文
posted @ 2020-08-24 11:19 anobscureretreat 阅读(524) 评论(0) 推荐(0)
摘要:code1 class mytest(): def __str__(self): return "hello" def __repr__(self): return "world" a=mytest() print(a) print(str(a)) print(repr(a)) outputs he 阅读全文
posted @ 2020-08-23 23:55 anobscureretreat 阅读(134) 评论(0) 推荐(0)
摘要:code import time #—————————————————————————————————————————————— #死循环打印1 ''' def count_n1(): return 1 for i in iter(count_n1, 6): print(i) ''' #—————— 阅读全文
posted @ 2020-08-23 23:39 anobscureretreat 阅读(3920) 评论(0) 推荐(0)
摘要:code >>> import django >>> django.version Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'django' has n 阅读全文
posted @ 2020-08-23 11:11 anobscureretreat 阅读(219) 评论(0) 推荐(0)
摘要:code 1.每个缩进层级使用4个空格。 2.每行最多79个字符。 3.顶层的函数(def)或类(class)的定义之间空两行。 4.采用ASCII或UTF-8编码文件。(就是在里面表明编码格式,ASCII编码格式或者是UTF-8的编码格式) 5.在文件的顶端,注释和文档说明之下,每行每条impor 阅读全文
posted @ 2020-08-23 11:06 anobscureretreat 阅读(321) 评论(0) 推荐(0)
摘要:在python中的random.randint(a,b)用于生成一个指定范围内的整数zd。 其中参数专a是下限,参数b是上限,生成的随机数n: a <= n <= b。 所以random.randint(9,10)的意思是: 生成大于等于9,小于等于10的随机整数。 因此这句得到的结果不是9,就是1 阅读全文
posted @ 2020-08-23 11:05 anobscureretreat 阅读(862) 评论(0) 推荐(0)
摘要:code macname@MacdeMBP Desktop % python3 test.py /Users/macname/Desktop/test.py /Users/macname/Desktop macname@MacdeMBP Desktop % cat test.py #coding=u 阅读全文
posted @ 2020-08-23 11:04 anobscureretreat 阅读(946) 评论(0) 推荐(0)
摘要:下载驱动后,解压 然后将可执行文件放在/usr/local/bin/下面 在命令输入chromedriver后出现以下内容,表示配置成功 macname@MacdeMacBook-Pro ui_web_automation % chromedriver Starting ChromeDriver 8 阅读全文
posted @ 2020-08-23 11:02 anobscureretreat 阅读(314) 评论(0) 推荐(0)
摘要:安装 pip3.7 install pyperclip code import pyperclip pyperclip.copy('hello world') print(pyperclip.paste()) output Python 3.7.4 (v3.7.4:e09359112e, Jul 8 阅读全文
posted @ 2020-08-23 11:00 anobscureretreat 阅读(1093) 评论(0) 推荐(0)
摘要:code import logging logger = logging.getLogger(__name__) logger.setLevel(level = logging.INFO) handler = logging.FileHandler("log.txt") handler.setLev 阅读全文
posted @ 2020-08-23 10:57 anobscureretreat 阅读(130) 评论(0) 推荐(0)
摘要:code macname@MacdeMacBook-Pro new % python3 Python 3.7.4 (v3.7.4:e09359112e, Jul 8 2019, 14:54:52) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", 阅读全文
posted @ 2020-08-23 10:56 anobscureretreat 阅读(833) 评论(0) 推荐(0)
摘要:code >>> a="192.168.0.5:5000" >>> f'http://{a}/chain' 'http://192.168.0.5:5000/chain' 阅读全文
posted @ 2020-08-23 10:54 anobscureretreat 阅读(692) 评论(0) 推荐(0)
摘要:链接:https://pan.baidu.com/s/1isjLEUPZpkz0F3c45a59KA 密码:bueu 如果失效,点这里 阅读全文
posted @ 2020-08-22 23:19 anobscureretreat 阅读(869) 评论(0) 推荐(0)
摘要:code import os cur=os.path.dirname(os.path.abspath(__file__)) print(cur) b=os.path.dirname(cur) print(b) dir=os.path.join(os.path.dirname(os.path.dirn 阅读全文
posted @ 2020-08-19 18:02 anobscureretreat 阅读(349) 评论(0) 推荐(0)
摘要:code import os import shutil shutil.move(u'F:\\learn_py\\testdata\\PPT蒙板.docx','F:\\learn_py') 阅读全文
posted @ 2020-08-19 18:00 anobscureretreat 阅读(224) 评论(0) 推荐(0)
摘要:1.只接受本机的访问,192.168.1.3是本机IP from flask import Flask app = Flask(__name__) @app.route("/hello") def hello(): return "hello world" app.run(host="192.168 阅读全文
posted @ 2020-08-19 17:56 anobscureretreat 阅读(197) 评论(0) 推荐(0)
摘要:安装库 pip3 install paho-mqtt 发布话题 import paho.mqtt.client as mqtt import time import sys HOST = "103.77.337.89" PORT = 1883 def on_connect(client, userd 阅读全文
posted @ 2020-08-19 12:45 anobscureretreat 阅读(1091) 评论(0) 推荐(0)
摘要:问题 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 示例: 给定 nums = [2, 7, 11, 15], target = 9 因为 阅读全文
posted @ 2020-08-19 11:56 anobscureretreat 阅读(201) 评论(0) 推荐(0)
摘要:问题 给出两个 非空 的链表用来表示两个非负的整数。其中,它们各自的位数是按照 逆序 的方式存储的,并且它们的每个节点只能存储 一位 数字。 如果,我们将这两个数相加起来,则会返回一个新的链表来表示它们的和。 您可以假设除了数字 0 之外,这两个数都不会以 0 开头。 示例: 输入:(2 -> 4 阅读全文
posted @ 2020-08-19 11:55 anobscureretreat 阅读(143) 评论(0) 推荐(0)
摘要:问题 给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。 示例 1: 输入: "abcabcbb" 输出: 3 解释: 因为无重复字符的最长子串是 "abc",所以其长度为 3。 示例 2: 输入: "bbbbb" 输出: 1 解释: 因为无重复字符的最长子串是 "b",所以其长度为 阅读全文
posted @ 2020-08-19 11:54 anobscureretreat 阅读(214) 评论(0) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 48 下一页