原创 (六)Python列表類型練習

# 列表 list1 = ['Google', 'Runoob', 1997, 2000] list2 = [1, 2, 3, 4, 5] list3 = ["a", "b", "c", "d"] print(list1[0]

原创 (十一)Python迭代器生成器練習

# 迭代器與生成器 # iter() 和 next() listTest = [1, 2, 3] listTest = iter(listTest) print(next(listTest)) print(next(listTe

原创 (七)Python元祖類型練習

# 元祖 tup1 = ('Google', 'Runoob', 1997, 2000); tup2 = (1, 2, 3, 4, 5) # 不需要括號也可以 tup3 = "a", "b", "c", "d" print(t

原创 ORM框架(SQLAlchemy)

mysql使用練習可以參考我的python3爬坑之路中第十七節 # 安裝模塊 # pip install sqlalchemy from sqlalchemy import create_engine from sqlalchem

原创 ODM框架(mongoengine)

pythonMongoDB使用練習可以參考我的python3爬坑之路中第二十三節 # 安裝模塊 # pip install mongoengine from mongoengine import connect, Documen

原创 Elasticsearch篇之Mapping設置

Elasticsearch篇之Mapping設置 Mapping簡介 類似數據庫中的表結構定義,主要作用如下: 定義Index下的字段名(Field Name) 定義字段的類型,比如數值型、字符串型、布爾型等 定義倒排索引相關的

原创 3.elasticsearch-head

git地址 git clone git://github.com/mobz/elasticsearch-head.git cd elasticsearch-head npm install npm run start 打開鏈接

原创 4.elasticsearch-php中future模式

參考鏈接 <?php require 'vendor/autoload.php'; use Monolog\Logger; use Elasticsearch\ClientBuilder; $logger = new Logge

原创 2.elasticsearch-php

1.在國內下載網址下載elasticsearch 2.解壓運行 bin\elasticsearch.bat 3.打開瀏覽器輸入 http://localhost:9200/ 4.創建composer.json { "

原创 (十二)Python函數練習

# 函數 # 定義函數 def print_me(test): # 打印任何傳入的字符串 print(test) # 調用函數 print_me("我要調用用戶自定義函數!") print_me("再次調用

原创 5.elasticsearch-php索引文檔搜索文檔

索引文檔 搜索文檔 <?php require 'vendor/autoload.php'; use Elasticsearch\ClientBuilder; $client = ClientBuilder::create()-

原创 (二十)Python 解析xml練習

import xml.dom.minidom # 使用minidom解析器打開 XML 文檔 DOMTree = xml.dom.minidom.parse("movies.xml") collection = DOMTree.

原创 (二十一)Python Json練習

import json data = { 'no': 1, 'name': 'WangFan', 'url': 'http://www.WangFan.com' } json_str = json.du

原创 (八)Python字典類型練習

# 字典 dict1 = {'Alice': '2341', 'Beth': '9102', 'Cecil': '3258'} dict2 = {'abc': 456} dict3 = {'abc': 456, 'def': 78

原创 (十四)Python系統OS和import練習

#!/usr/bin/python3 import os res = os.access('0015.py', os.F_OK) print(res) res = os.access('0015.py', os.R_OK)