摘要: #gca='get current axis' ax = plt.gca() ax.spines['right'].set_color('none') ax.spines['top'].set_color('none') ax.xaxis.set_ticks_position('bottom') a 阅读全文
posted @ 2018-12-06 16:48 萧白白 阅读(1199) 评论(0) 推荐(0)
摘要: import matplotlib.pyplot as plt import numpy as np x=np.linspace(-3,3,50) y1=x*2+1 y2=x**2 plt.plot(x,y1) plt.figure(num=3,figsize=(8,5)) plt.plot(x,y2) plt.plot(x,y1,color="red",linewidth=1.0,line... 阅读全文
posted @ 2018-12-06 16:20 萧白白 阅读(189) 评论(0) 推荐(0)
摘要: import threading def job1(): global A, lock lock.acquire() for i in range(10): A += 1 print('job1', A) lock.release() def job2(): global A, lock lock.acquire... 阅读全文
posted @ 2018-12-06 15:40 萧白白 阅读(247) 评论(0) 推荐(0)
摘要: import threading import time from queue import Queue def job(l,q): for i in range(len(l)): l[i] =l[i]**2 q.put(l) def multithreading(): q = Queue() threads = [] date =[[... 阅读全文
posted @ 2018-12-06 13:43 萧白白 阅读(164) 评论(0) 推荐(0)
摘要: import threading import time def thread_job(): print("T1 start\n") for i in range(30): time.sleep(0.1) print("T1 finish\n") def T2_job(): print("T2 start\n") print("T2 f... 阅读全文
posted @ 2018-12-06 13:11 萧白白 阅读(168) 评论(0) 推荐(0)
摘要: import threading def thread_job(): print("This is an added Thread,number is %s"% threading.current_thread()) def main(): #添加线程 added_thread =threading.Thread(target=thread_job) added... 阅读全文
posted @ 2018-12-06 12:48 萧白白 阅读(261) 评论(0) 推荐(0)
摘要: import tensorflow as tf import numpy as np x_data= np.random.rand(100).astype(np.float32) y_data = x_data*0.1 +0.3 Weights = tf.Variable(tf.random_uniform([1],-1.0,1.0)) biases = tf.Variable(tf.zer... 阅读全文
posted @ 2018-12-05 19:51 萧白白 阅读(204) 评论(0) 推荐(0)
摘要: from bs4 import BeautifulSoup import requests import os os.makedirs('./img/', exist_ok=True) URL = "http://www.nationalgeographic.com.cn/animals/" html = requests.get(URL).text soup = BeautifulSoup... 阅读全文
posted @ 2018-12-03 21:16 萧白白 阅读(3649) 评论(0) 推荐(0)
摘要: import os os.makedirs('./img/', exist_ok=True) IMAGE_URL = "https://morvanzhou.github.io/static/img/description/learning_step_flowchart.png" def urllib_download(): from urllib.request import u... 阅读全文
posted @ 2018-12-03 21:13 萧白白 阅读(4108) 评论(0) 推荐(0)
摘要: def post_name(): print('\npost name') # http://pythonscraping.com/pages/files/form.html data = {'firstname': '莫烦', 'lastname': '周'} r = requests.post('http://pythonscraping.com/files/... 阅读全文
posted @ 2018-12-03 20:29 萧白白 阅读(6323) 评论(0) 推荐(0)