<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>模块 on 庞玉栋个人博客</title><link>https://pangyd.com/tags/%E6%A8%A1%E5%9D%97/</link><description>Recent content in 模块 on 庞玉栋个人博客</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Wed, 11 Dec 2019 10:22:05 +0800</lastBuildDate><atom:link href="https://pangyd.com/tags/%E6%A8%A1%E5%9D%97/index.xml" rel="self" type="application/rss+xml"/><item><title>Matplotlib模块整理</title><link>https://pangyd.com/post/226-matplotlib/</link><pubDate>Fri, 08 Nov 2019 11:53:24 +0800</pubDate><guid>https://pangyd.com/post/226-matplotlib/</guid><description>&lt;img src="https://pangyd.com/uploads/2019/05/c209f3e0a8b3557e.png" alt="FireShot Capture 004 - Untitled - localhost_gaitubao_1304x21192.png"></description></item><item><title>re正则模块详解</title><link>https://pangyd.com/post/206-re/</link><pubDate>Wed, 07 Nov 2018 08:10:45 +0800</pubDate><guid>https://pangyd.com/post/206-re/</guid><description>&lt;p>re正则表达式是一种工具，和其他工具一样，它是人们为了解决某一类专门的问题而发明的。想要理解正则表达式及其功用。最好的办法是了解他们可以解决什么样的问题&lt;/p>&lt;p>正则表达式的主要用途之一是搜索变化多端的文本，比如，搜索以http开头的 以句号等空白字结尾的字符串&amp;nbsp;&lt;/p>&lt;p>&lt;br>&lt;/p>&lt;p>&lt;/p>&lt;pre lay-lang="Python" class="layui-code" skin="notepad">import re
&lt;p>text = &amp;ldquo;The Attila the Hun Show&amp;rdquo;&lt;/p>
&lt;h1 id="a-single-character-单个字符">a single character 单个字符&lt;/h1>
&lt;p>m = re.match(&amp;quot;.&amp;quot;, text)
if m: print repr(&amp;quot;.&amp;quot;), &amp;ldquo;=&amp;gt;&amp;rdquo;, repr(m.group(0))&lt;/p>
&lt;h1 id="any-string-of-characters-任何字符串">any string of characters 任何字符串&lt;/h1>
&lt;p>m = re.match(&amp;quot;.&lt;em>&amp;quot;, text)
if m: print repr(&amp;quot;.&lt;/em>&amp;quot;), &amp;ldquo;=&amp;gt;&amp;rdquo;, repr(m.group(0))&lt;/p>
&lt;h1 id="a-string-of-letters-at-least-one-只包含字母的字符串至少一个">a string of letters (at least one) 只包含字母的字符串(至少一个)&lt;/h1>
&lt;p>m = re.match(&amp;quot;\w+&amp;quot;, text)
if m: print repr(&amp;quot;\w+&amp;quot;), &amp;ldquo;=&amp;gt;&amp;rdquo;, repr(m.group(0))&lt;/p>
&lt;h1 id="a-string-of-digits-只包含数字的字符串">a string of digits 只包含数字的字符串&lt;/h1>
&lt;p>m = re.match(&amp;quot;\d+&amp;quot;, text)
if m: print repr(&amp;quot;\d+&amp;quot;), &amp;ldquo;=&amp;gt;&amp;rdquo;, repr(m.group(0))&lt;/p></description></item><item><title>Python中操作mysql的pymysql模块详解</title><link>https://pangyd.com/post/197-pythonmysqlpymysql/</link><pubDate>Mon, 06 Aug 2018 18:06:31 +0800</pubDate><guid>https://pangyd.com/post/197-pythonmysqlpymysql/</guid><description>&lt;div>&lt;div>&lt;div class="article">&lt;div data-note-content="" class="show-content">&lt;div class="show-content-free">&lt;p>&lt;a href="https://link.jianshu.com?t=https://github.com/PyMySQL/PyMySQL" target="_blank" rel="nofollow">PyMySQL&lt;/a>是一个Python编写的MySQL驱动程序，让我们可以用Python语言操作MySQL数据库。&lt;/p>
&lt;p>首先，使用pip安装PyMySQL。&lt;/p>
&lt;pre class="hljs undefined">&lt;code>pip install PyMySQL
&lt;/code>&lt;/pre>
&lt;h2>使用PyMySQL&lt;/h2>
&lt;h3>简单使用&lt;/h3>
&lt;p>如果有JDBC等其他语言的数据库学习经验的话，使用PyMySQL非常简单。下面是一个完整的MySQL增删查（没有改）的例子。&lt;/p>
&lt;pre class="hljs python">&lt;code class="python">&lt;span class="hljs-keyword">import&lt;/span> pymysql
&lt;span class="hljs-keyword">import&lt;/span> datetime
&lt;p>host = &lt;span class="hljs-string">&amp;lsquo;localhost&amp;rsquo;&lt;/span>
username = &lt;span class="hljs-string">&amp;lsquo;root&amp;rsquo;&lt;/span>
password = &lt;span class="hljs-string">&amp;lsquo;12345678&amp;rsquo;&lt;/span>
db_name = &lt;span class="hljs-string">&amp;lsquo;test&amp;rsquo;&lt;/span>&lt;/p>
&lt;p>create_table_sql = &lt;span class="hljs-string">&amp;quot;&amp;quot;&amp;quot;&lt;br>
CREATE TABLE fuck(
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) UNIQUE ,
nickname VARCHAR(255) NOT NULL ,
birthday DATE
)
&amp;ldquo;&amp;rdquo;&amp;quot;&lt;/span>&lt;/p>
&lt;p>insert_table_sql = &lt;span class="hljs-string">&amp;quot;&amp;quot;&amp;quot;&lt;br>
INSERT INTO fuck(username,nickname,birthday)
VALUES(&amp;rsquo;{username}&amp;rsquo;,&amp;rsquo;{nickname}&amp;rsquo;,&amp;rsquo;{birthday}&amp;rsquo;)
&amp;ldquo;&amp;rdquo;&amp;quot;&lt;/span>&lt;/p>
&lt;p>query_table_sql = &lt;span class="hljs-string">&amp;quot;&amp;quot;&amp;quot;&lt;br>
SELECT id,username,nickname,birthday
FROM fuck
&amp;ldquo;&amp;rdquo;&amp;quot;&lt;/span>&lt;/p>
&lt;p>delete_table_sql = &lt;span class="hljs-string">&amp;quot;&amp;quot;&amp;quot;&lt;br>
DELETE FROM fuck
&amp;ldquo;&amp;rdquo;&amp;quot;&lt;/span>&lt;/p>
&lt;p>drop_table_sql = &lt;span class="hljs-string">&amp;quot;&amp;quot;&amp;quot;&lt;br>
DROP TABLE fuck
&amp;ldquo;&amp;rdquo;&amp;quot;&lt;/span>&lt;/p></description></item></channel></rss>