03 2019 档案

摘要:执行更新数据(sudo apt-get update)提示: 此时只要编辑网络DNS配置文件即可: 在弹出的文本里最下面加入: cat /etc/resolv.conf# Dynamic resolv.conf(5) file for glibc resolver(3) generated by r 阅读全文
posted @ 2019-03-29 14:11 晨光曦微 阅读(7893) 评论(0) 推荐(0) 编辑
摘要:国内有很多Ubuntu的镜像源,包括阿里的、网易的,还有很多教育网的源,比如:清华源、中科大源。 我们这里以清华源为例讲解如何修改Ubuntu 18.04里面默认的源。 1、输入命令修改sources.list文件,当然需要超级权限,所以要加sudo(如提示没权限,被占用,等等,直接重启系统); 或 阅读全文
posted @ 2019-03-29 13:44 晨光曦微 阅读(5207) 评论(0) 推荐(1) 编辑
摘要:知识点: JavaScript 函数对参数的值(arguments)没有进行任何的检查。 JavaScript 函数参数与大多数其他语言的函数参数的区别在于:它不会关注有多少个参数被传递,不关注传递的参数的数据类型。 参数规则: JavaScript 函数定义时参数没有指定数据类型。 JavaScr 阅读全文
posted @ 2019-03-27 11:49 晨光曦微 编辑
摘要:一、多线程简单示例 二、多线程传递多参数、可选参数示例 三、并发问题 可以轻松地创建多个新线程,让它们同时运行。但多线程也可能会导致所谓的并发问题。如果这些线程同时读写变量,导致互相干扰,就会发生并发问题。并发问题可能很难一致地重现,所以难以调试。多线程编程本身就是一个广泛的主题。必须记住的是:为了 阅读全文
posted @ 2019-03-23 15:21 晨光曦微 阅读(406) 评论(0) 推荐(0) 编辑
摘要:一、【连接mongo服务】、【连接数据库】、【连接集合】 二、【插入数据新版本】在用: 二、插入数据老版本(不建议用): 三、【查询一】用 find_one() 或 find() 方法进行查询,find_one() 查询得到是单个结果,find() 则返回一个生成器对象。 三、【查询二】单条数据查询 阅读全文
posted @ 2019-03-21 16:50 晨光曦微 阅读(198) 评论(0) 推荐(0) 编辑
摘要:#一.【连接Mongo】 import pymongo #方法一 client = pymongo.MongoClient(host='localhost', port=27017) #方法二 client = MongoClient('mongodb://localhost:27017/') #二.【连接mongo指定数据库’test ‘】: #方法一 db = client.test #方... 阅读全文
posted @ 2019-03-21 16:40 晨光曦微 阅读(104) 评论(0) 推荐(0) 编辑
摘要:D:\MongoDB\Server\4.0\bin 下载地址:https://www.mongodb.com/download-center/community 中文教程:http://www.runoob.com/mongodb/mongodb-window-install.html 简介 在爬虫 阅读全文
posted @ 2019-03-21 16:08 晨光曦微 编辑
摘要:python库:pymysql 安装:install pymysql、mysql数据库 一、连接数据库、创建speder库、查询版本、 二、创建表 三、插入数据 3.1、【插入数据2.0升级版,用字典插入数据,不用修改sql语句,只要修改字典即可】 四、更新数据 五、删除数据 六、查询数据 阅读全文
posted @ 2019-03-20 16:54 晨光曦微 阅读(1105) 评论(0) 推荐(0) 编辑
该文被密码保护。
posted @ 2019-03-19 14:33 晨光曦微 编辑
摘要:安装python3.7,安装成功后,在cmd窗口输入python检查是否安装成功,报错:无法启动此程序,因为计算机中丢失api-ms-win-crt-process-l1-1-0.dll 在网上查询了多种方法试过都未解决: 方法1:网上下载vc_redist.x64.exe ,安装后重启电脑,也未能 阅读全文
posted @ 2019-03-17 17:55 晨光曦微 编辑
摘要:#!python3.7 import requests,sys,time,logging,random from lxml import etree logging.basicConfig(level=logging.ERROR, format=' %(asctime)s - %(levelname)s: %(message)s') #DEBUG ERROR format显示格式可按自己喜好调整... 阅读全文
posted @ 2019-03-15 17:02 晨光曦微 阅读(920) 评论(0) 推荐(0) 编辑
摘要:调试过程将显示: 2019-03-15 14:17:01,538 - DEBUG: 程序现在开始! 2019-03-15 14:17:01,548 - DEBUG: 开始执行:factorial(5) 2019-03-15 14:17:01,551 - DEBUG: 此处【i】值是:0,【total 阅读全文
posted @ 2019-03-15 14:12 晨光曦微 阅读(738) 评论(0) 推荐(0) 编辑
摘要:#python3.7 ''' 功能:实现www.biqukan.com/1_1094/5403177.html小说下载为txtv1.0 ''' import requests,sys,time from lxml import etree ##0.获取所有章节url def get_url_list(catalog_url): res=requests.get(catalog_url) ... 阅读全文
posted @ 2019-03-15 13:31 晨光曦微 阅读(567) 评论(0) 推荐(0) 编辑
摘要:var n=1; if(n>1){ n=0; }else{ n++; } console.log(n); #输出结果:2 var n=1; n = n>1?0 : n++; console.log(n); #输出结果为:1 例子2: var n=1; if(n>1){ n=0; }else{ ++n; } console.log(n); #输出结果:2 ... 阅读全文
posted @ 2019-03-14 14:35 晨光曦微 阅读(334) 评论(0) 推荐(0) 编辑
摘要:new document 点我 阅读全文
posted @ 2019-03-14 10:45 晨光曦微 阅读(667) 评论(0) 推荐(0) 编辑
摘要:# -*- coding: utf-8 -*- """ Created on Wed May 9 14:12:25 2018 @author: JJ """ #12306账号 myuser="" mypasswd="" import urllib.request import re import ssl import urllib.parse import http.cookiejar imp... 阅读全文
posted @ 2019-03-13 16:53 晨光曦微 阅读(432) 评论(0) 推荐(0) 编辑
该文被密码保护。
posted @ 2019-03-13 16:52 晨光曦微 阅读(3) 评论(0) 推荐(0) 编辑
摘要:数据库(右键打开位置,找到users点进去,第一个.db即文件列表,内含hd5),复制到同一目录: 阅读全文
posted @ 2019-03-13 16:50 晨光曦微 阅读(382) 评论(0) 推荐(0) 编辑
摘要:#!coding=utf-8 import requests import re import time import json from requests.packages.urllib3.exceptions import InsecureRequestWarning import pandas as pd requests.packages.urllib3.disable_warnings... 阅读全文
posted @ 2019-03-13 16:44 晨光曦微 阅读(422) 评论(0) 推荐(0) 编辑
摘要:import pymysql db = pymysql.connect(host='localhost', user='root', password='pz2212', port=3306, db='spiders') cursor = db.cursor() data = { 'id': '20120001', 'name': 'Bob', 'age': 20 } t... 阅读全文
posted @ 2019-03-13 16:42 晨光曦微 阅读(224) 评论(0) 推荐(0) 编辑
摘要:import mitmproxy.http from mitmproxy import ctx, http class Joker: def request(self, flow: mitmproxy.http.HTTPFlow): if flow.request.host != "www.baidu.com" or not flow.request.path.sta... 阅读全文
posted @ 2019-03-13 16:41 晨光曦微 阅读(483) 评论(0) 推荐(0) 编辑
摘要:from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support import expected_conditions as ec from seleni... 阅读全文
posted @ 2019-03-13 16:39 晨光曦微 阅读(490) 评论(0) 推荐(0) 编辑
摘要:#!python3 #updateProduce.py-更正指定产品 成本价格(第二列) import openpyxl wb=openpyxl.load_workbook('produceSales.xlsx') sheet=wb.active #或sheet=wb['Sheet'] # 需要更新成本价格的产品,字典格式 PRICE_UPDATES = {'Garlic': 3.07, ... 阅读全文
posted @ 2019-03-13 16:33 晨光曦微 阅读(289) 评论(0) 推荐(0) 编辑
摘要:import requests from pyquery import PyQuery as pq url='https://www.zhihu.com/explore' headers={ 'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Geck... 阅读全文
posted @ 2019-03-13 16:30 晨光曦微 阅读(330) 评论(0) 推荐(0) 编辑
摘要:grid = [['.', '.', '.', '.', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['O', 'O', 'O', 'O', 阅读全文
posted @ 2019-03-13 16:28 晨光曦微 阅读(99) 评论(0) 推荐(0) 编辑
摘要:name = ''#名字为空即代表False while not name:#not name=False即 真,将执行循环体 print('Enter your name:') name = input()#给name赋值,如输入了空以外值,不会再有下一个循环while print('How many guests will you have?') numOfG... 阅读全文
posted @ 2019-03-13 16:27 晨光曦微 阅读(325) 评论(0) 推荐(0) 编辑
摘要:#让用户输入一个宠物名字,然后检查该名字是否在宠物列表中 myPets = ['Zophie', 'Pooka', 'Fat-tail'] print('Enter a pet name:') name = input() if name not in myPets: print('I do not have a pet named ' + name) else: print(n... 阅读全文
posted @ 2019-03-13 16:25 晨光曦微 阅读(216) 评论(0) 推荐(0) 编辑
摘要:#! python3 # mapIt.py - Launches a map in the browser using an address from the # command line or clipboard. import webbrowser, sys, pyperclip #如果命令输入了参数,就从命令里得到地名 if len(sys.argv) > 1: # Get add... 阅读全文
posted @ 2019-03-13 16:24 晨光曦微 阅读(341) 评论(0) 推荐(0) 编辑
摘要:import requests,re,json,time from requests.exceptions import RequestException headers={ 'User-Agent':'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' } def get_one_page(url): r=requests.g... 阅读全文
posted @ 2019-03-13 16:23 晨光曦微 阅读(230) 评论(0) 推荐(0) 编辑
摘要:#匹配电话,例如:415-555-4242 def isPhoneNumber(text): if len(text) != 12: return False for i in range(0, 3): if not text[i].isdecimal(): return False if text[3] != '-... 阅读全文
posted @ 2019-03-13 16:21 晨光曦微 阅读(468) 评论(0) 推荐(0) 编辑
摘要:import traceback try: raise Exception('这是一个错误信息') except: errFile=open('err.txt','w') errFile.write(traceback.format_exc()) errFile.close() print('错误信息已经写入err.txt文件中') 阅读全文
posted @ 2019-03-13 16:20 晨光曦微 阅读(204) 评论(0) 推荐(0) 编辑
摘要:import requests,bs4,os #利用 requests 模块下载页面 url='http://xkcd.com' os.makedirs('xkcd', exist_ok=True) #创建一个文件夹xkcd while not url.endswith('#'): res=requests.get(url) res.raise_for_status() #没... 阅读全文
posted @ 2019-03-13 16:19 晨光曦微 阅读(722) 评论(0) 推荐(0) 编辑
摘要:class Dog(): def __init__(self,name,age): self.name=name self.age=age def sit(self): print(self.name.title()+' 现在坐下了') def roll_over(self): print(self.name... 阅读全文
posted @ 2019-03-13 16:18 晨光曦微 阅读(260) 评论(0) 推荐(0) 编辑
摘要:def hello(): print('Howdy!') print('Howdy!!!') print('Hello there.') hello() 阅读全文
posted @ 2019-03-13 16:17 晨光曦微 阅读(196) 评论(0) 推荐(0) 编辑
摘要:import random heads = 0 for i in range(1, 1001): if random.randint(0, 1) == 1: heads = heads + 1 if i == 500: print('Halfway done!') print('Heads came up ' + str(heads) + ' ti... 阅读全文
posted @ 2019-03-13 16:15 晨光曦微 阅读(130) 评论(0) 推荐(0) 编辑
摘要:##小程序,计算一个字符串中每个字符出现的次数+ import pprint message = 'It was a bright cold day in April, and the clocks were striking thirteen.' count = {} for character in message: count.setdefault(character, 0) ... 阅读全文
posted @ 2019-03-13 16:14 晨光曦微 阅读(680) 评论(0) 推荐(0) 编辑
摘要:''' picnicItems 野餐用品清单 picnicItems sandwiches.................... 4apples........................ 12cups.......................... 4cookies........... 阅读全文
posted @ 2019-03-13 16:13 晨光曦微 阅读(223) 评论(0) 推荐(0) 编辑
摘要:def boxPrint(symbol, width, height): if len(symbol) != 1: raise Exception('Symbol(符号) must be a single character string.') if width <= 2: raise Exception('Width must be greate... 阅读全文
posted @ 2019-03-13 16:12 晨光曦微 阅读(324) 评论(0) 推荐(0) 编辑
摘要:birthdays = {'Alice': 'Apr 1', 'Bob': 'Dec 12', 'Carol': 'Mar 4'} while True: print('Enter a name: (blank to quit)') name = input() if name == '': break if name in birthdays: ... 阅读全文
posted @ 2019-03-13 16:09 晨光曦微 阅读(230) 评论(0) 推荐(0) 编辑
该文被密码保护。
posted @ 2019-03-13 16:06 晨光曦微 阅读(2) 评论(0) 推荐(0) 编辑
摘要:import requests from pyquery import PyQuery as pq url='http://www.51xxx.com/Try/index/p/3' headers={ 'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chro... 阅读全文
posted @ 2019-03-13 16:03 晨光曦微 阅读(655) 评论(0) 推荐(0) 编辑
摘要:A.右键.py文件,edit with idle B.如果没有这个选项: 选择打开方式,进入python安装路径,选择 Python37\Lib\idlelib\idle.bat 阅读全文
posted @ 2019-03-13 15:56 晨光曦微 阅读(5758) 评论(3) 推荐(2) 编辑
摘要:''' 【生产者】正在生产 1 中......【消费者】正在消费 1 中...【生产者】消费者返回了:OK,完成消费!! !【生产者】正在生产 2 中......【消费者】正在消费 2 中...【生产者】消费者返回了:OK,完成消费!! !【生产者】正在生产 3 中......【消费者】正在消费 3 阅读全文
posted @ 2019-03-13 15:35 晨光曦微 阅读(279) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示