index.html 46.9 KB
Newer Older
T
TRHX 已提交
1 2 3 4 5
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
T
TRHX 已提交
6
  <title>Python3 自学笔记 C01 | TRHX&#39;s Blog - Live for code!</title>
T
TRHX 已提交
7 8 9 10 11
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="Python3 【变量和简单数据类型】">
<meta name="keywords" content="数据类型,变量">
<meta property="og:type" content="article">
<meta property="og:title" content="Python3 自学笔记 C01">
T
TRHX 已提交
12
<meta property="og:url" content="https://trhx.top/2018/09/10/Python3 自学笔记 C01/index.html">
T
TRHX 已提交
13
<meta property="og:site_name" content="TRHX&#39;s Blog - Live for code!">
T
TRHX 已提交
14 15 16
<meta property="og:description" content="Python3 【变量和简单数据类型】">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://i.imgur.com/Do9ja5A.png">
T
TRHX 已提交
17
<meta property="og:updated_time" content="2018-09-15T17:09:09.035Z">
T
TRHX 已提交
18 19 20 21 22 23
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Python3 自学笔记 C01">
<meta name="twitter:description" content="Python3 【变量和简单数据类型】">
<meta name="twitter:image" content="https://i.imgur.com/Do9ja5A.png">
  
  
T
TRHX 已提交
24
    <link rel="icon" href="/img/trhx2.png">
T
TRHX 已提交
25 26 27 28 29 30 31 32 33 34 35 36 37 38
  
  
  <link rel="stylesheet" href="/css/style.css">
  <link rel="stylesheet" href="/font-awesome/css/font-awesome.min.css">
  <link rel="apple-touch-icon" href="/apple-touch-icon.png">
  
  
      <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  
  <!-- 加载特效 -->
    <script src="/js/pace.js"></script>
    <link href="/css/pace/pace-theme-flash.css" rel="stylesheet" />
  <script>
      var yiliaConfig = {
T
TRHX 已提交
39
          rootUrl: '/',
T
TRHX 已提交
40
          fancybox: true,
T
TRHX 已提交
41
          animate: false,
T
TRHX 已提交
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
          isHome: false,
          isPost: true,
          isArchive: false,
          isTag: false,
          isCategory: false,
          open_in_new: false
      }
  </script>
</head>
<body>
  <div id="container">
    <div class="left-col">
    <div class="overlay"></div>
<div class="intrude-less">
    <header id="header" class="inner">
        <a href="/" class="profilepic">
            
T
TRHX 已提交
59
            <img src="/img/trhx.png" class="js-avatar" style="width: 100%;height: 100%;opacity: 1;">
T
TRHX 已提交
60 61
            
        </a>
T
TRHX 已提交
62

T
TRHX 已提交
63
        <hgroup>
T
TRHX 已提交
64
          <h1 class="header-author"><a href="/" title="Hi Mate">TRHX</a></h1>
T
TRHX 已提交
65
        </hgroup>
T
TRHX 已提交
66

T
TRHX 已提交
67
        
T
TRHX 已提交
68
        <p class="header-subtitle">路漫漫其修远兮,吾将上下而求索!</p>
T
TRHX 已提交
69 70 71
        
        
            <form>
T
TRHX 已提交
72
                <input type="text" class="st-default-search-input search" id="search" placeholder=" Search...">
T
TRHX 已提交
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
            </form>
        
        
            <div id="switch-btn" class="switch-btn">
                <div class="icon">
                    <div class="icon-ctn">
                        <div class="icon-wrap icon-house" data-idx="0">
                            <div class="birdhouse"></div>
                            <div class="birdhouse_holes"></div>
                        </div>
                        <div class="icon-wrap icon-ribbon hide" data-idx="1">
                            <div class="ribbon"></div>
                        </div>
                        
                        
                        <div class="icon-wrap icon-me hide" data-idx="3">
                            <div class="user"></div>
                            <div class="shoulder"></div>
                        </div>
                        
                    </div>
T
TRHX 已提交
94
                    
T
TRHX 已提交
95 96 97 98 99
                </div>
                <div class="tips-box hide">
                    <div class="tips-arrow"></div>
                    <ul class="tips-inner">
                        <li>菜单</li>
T
TRHX 已提交
100
                        <li>标签云</li>
T
TRHX 已提交
101 102 103 104 105 106 107 108 109 110 111 112 113 114
                        
                        
                        <li>关于我</li>
                        
                    </ul>
                </div>
            </div>
        
        <div id="switch-area" class="switch-area">
            <div class="switch-wrap">
                <section class="switch-part switch-part1">
                    <nav class="header-menu">
                        <ul>
                        
T
TRHX 已提交
115
                            <li><a href="http://trhx.top">博客首页</a></li>
T
TRHX 已提交
116
                        
T
TRHX 已提交
117
                            <li><a href="/archives">所有文章</a></li>
T
TRHX 已提交
118
                        
T
TRHX 已提交
119
                            <li><a href="/tags">静心阅读</a></li>
T
TRHX 已提交
120
                        
T
TRHX 已提交
121
                            <li><a href="/Message Board">友链 &amp; 留言板</a></li>
T
TRHX 已提交
122
                        
T
TRHX 已提交
123 124 125 126 127
                        </ul>
                    </nav>
                    <nav class="header-nav">
                        <ul class="social">
                            
T
TRHX 已提交
128
                                <a class="f1 github" target="_blank" href="https://github.com/TRHX" title="github">github</a>
T
TRHX 已提交
129
                            
T
TRHX 已提交
130
                                <a class="f1 CSDN" target="_blank" href="https://blog.csdn.net/qq_36759224" title="CSDN">CSDN</a>
T
TRHX 已提交
131
                            
T
TRHX 已提交
132
                                <a class="f1 zhihu" target="_blank" href="https://www.zhihu.com/people/tan-70-56/activities" title="zhihu">zhihu</a>
T
TRHX 已提交
133
                            
T
TRHX 已提交
134
                                <a class="f1 mail" target="_blank" href="mailto:&#116;&#114;&#104;&#120;&#64;&#102;&#111;&#120;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;" title="mail">mail</a>
T
TRHX 已提交
135
                            
T
TRHX 已提交
136
                                <a class="f1 QQ" target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=2273902448&site=qq&menu=yes" title="QQ">QQ</a>
T
TRHX 已提交
137
                            
T
TRHX 已提交
138
                                <a class="f1 weibo" target="_blank" href="http://weibo.com/TRHX1" title="weibo">weibo</a>
T
TRHX 已提交
139
                            
T
TRHX 已提交
140 141 142 143 144 145
                        </ul>
                    </nav>
                </section>
                
                <section class="switch-part switch-part2">
                    <div class="widget tagcloud" id="js-tagcloud">
T
TRHX 已提交
146
                        <a href="/tags/Dream/" style="font-size: 10px;">Dream</a> <a href="/tags/Github-Pages/" style="font-size: 10px;">Github Pages</a> <a href="/tags/Hexo/" style="font-size: 20px;">Hexo</a> <a href="/tags/Life/" style="font-size: 10px;">Life</a> <a href="/tags/Markdown/" style="font-size: 20px;">Markdown</a> <a href="/tags/Ubuntu/" style="font-size: 10px;">Ubuntu</a> <a href="/tags/VMware/" style="font-size: 10px;">VMware</a> <a href="/tags/if语句/" style="font-size: 10px;">if语句</a> <a href="/tags/input-函数/" style="font-size: 10px;">input()函数</a> <a href="/tags/while循环/" style="font-size: 10px;">while循环</a> <a href="/tags/主题个性化/" style="font-size: 10px;">主题个性化</a> <a href="/tags/函数/" style="font-size: 10px;">函数</a> <a href="/tags/列表/" style="font-size: 10px;">列表</a> <a href="/tags/变量/" style="font-size: 10px;">变量</a> <a href="/tags/字典/" style="font-size: 10px;">字典</a> <a href="/tags/异常/" style="font-size: 10px;">异常</a> <a href="/tags/技巧/" style="font-size: 10px;">技巧</a> <a href="/tags/操作列表/" style="font-size: 10px;">操作列表</a> <a href="/tags/数据类型/" style="font-size: 10px;">数据类型</a> <a href="/tags/文件/" style="font-size: 10px;">文件</a> <a href="/tags/模块/" style="font-size: 10px;">模块</a> <a href="/tags/类/" style="font-size: 10px;"></a> <a href="/tags/继承/" style="font-size: 10px;">继承</a> <a href="/tags/编辑器/" style="font-size: 10px;">编辑器</a>
T
TRHX 已提交
147 148 149 150
                    </div>
                </section>
                
                
T
TRHX 已提交
151

T
TRHX 已提交
152 153
                
                
T
TRHX 已提交
154
                <section class="switch-part switch-part3">
T
TRHX 已提交
155
                
T
TRHX 已提交
156
                    <div id="js-aboutme">单车入魔、编程入门、爱折腾、爱刺激、爱编程、爱科技</div>
T
TRHX 已提交
157 158 159 160
                </section>
                
            </div>
        </div>
T
TRHX 已提交
161
    </header>                
T
TRHX 已提交
162
</div>
T
TRHX 已提交
163 164 165

<div style="position:absolute; bottom:65px; left:0px; width:50%">
    <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=300 height=90 src="//music.163.com/outchain/player?type=2&id=32405683&auto=0&height=66"></iframe>
T
TRHX 已提交
166 167
</div>

T
TRHX 已提交
168
<!--
T
TRHX 已提交
169 170 171 172
<div style="position:absolute; bottom:0px; left:0px">
<script type="text/javascript" src="//ra.revolvermaps.com/0/0/3.js?i=0uxx4hengti&amp;b=0&amp;s=40&amp;m=0&amp;cl=54ff00&amp;co=0006ff&amp;cd=ff0000&amp;v0=60&amp;v1=100&amp;r=1" async="async"></script>
</div>

T
TRHX 已提交
173

T
TRHX 已提交
174
<div style="position:absolute; bottom:0px; left:150px">
T
TRHX 已提交
175
<script charset="Shift_JIS" src="http://chabudai.sakura.ne.jp/blogparts/honehoneclock/honehone_clock_tr.js"></script>
T
TRHX 已提交
176
</div>
T
TRHX 已提交
177
-->
T
TRHX 已提交
178

T
TRHX 已提交
179
<div style="position:absolute; bottom:0px; left:66px">
T
TRHX 已提交
180
<div align="center"><a href="http://www.amazingcounters.com"><img border="0" src="http://cc.amazingcounters.com/counter.php?i=3228467&c=9685714" alt="AmazingCounters.com"></a></div>
T
TRHX 已提交
181 182 183 184
</div>

<div style="position:absolute; bottom:0px; left:146px">
<div align="center"><a href="http://www.amazingcounters.com"><img border="0" src="http://cc.amazingcounters.com/counter.php?i=3228468&c=9685717" alt="AmazingCounters.com"></a></div>
T
TRHX 已提交
185 186 187 188 189 190
</div>
    </div>
    <div class="mid-col">
      <nav id="mobile-nav">
      <div class="overlay">
          <div class="slider-trigger"></div>
T
TRHX 已提交
191
          <h1 class="header-author js-mobile-header hide"><a href="/" title="Me">TRHX</a></h1>
T
TRHX 已提交
192 193 194 195 196
      </div>
    <div class="intrude-less">
        <header id="header" class="inner">
            <a href="/" class="profilepic">
                
T
TRHX 已提交
197
                    <img src="/img/trhx.png" class="js-avatar" style="width: 100%; height: 100%; opacity: 1;">
T
TRHX 已提交
198 199 200
                
            </a>
            <hgroup>
T
TRHX 已提交
201
              <h1 class="header-author"><a href="/" title="Me">TRHX</a></h1>
T
TRHX 已提交
202 203
            </hgroup>
            
T
TRHX 已提交
204
            <p class="header-subtitle">路漫漫其修远兮,吾将上下而求索!</p>
T
TRHX 已提交
205 206 207 208
            
            <nav class="header-menu">
                <ul>
                
T
TRHX 已提交
209
                    <li><a href="http://trhx.top">博客首页</a></li>
T
TRHX 已提交
210 211 212 213 214
                
                    <li><a href="/archives">所有文章</a></li>
                
                    <li><a href="/tags">静心阅读</a></li>
                
T
TRHX 已提交
215
                    <li><a href="/Message Board">友链 &amp; 留言板</a></li>
T
TRHX 已提交
216
                
T
TRHX 已提交
217 218 219 220 221 222 223 224
                <div class="clearfix"></div>
                </ul>
            </nav>
            <nav class="header-nav">
                <div class="social">
                    
                        <a class="github" target="_blank" href="https://github.com/TRHX" title="github">github</a>
                    
T
TRHX 已提交
225
                        <a class="CSDN" target="_blank" href="https://blog.csdn.net/qq_36759224" title="CSDN">CSDN</a>
T
TRHX 已提交
226
                    
T
TRHX 已提交
227 228 229 230 231 232
                        <a class="zhihu" target="_blank" href="https://www.zhihu.com/people/tan-70-56/activities" title="zhihu">zhihu</a>
                    
                        <a class="mail" target="_blank" href="mailto:&#116;&#114;&#104;&#120;&#64;&#102;&#111;&#120;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;" title="mail">mail</a>
                    
                        <a class="QQ" target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=2273902448&site=qq&menu=yes" title="QQ">QQ</a>
                    
T
TRHX 已提交
233 234
                        <a class="weibo" target="_blank" href="http://weibo.com/TRHX1" title="weibo">weibo</a>
                    
T
TRHX 已提交
235 236
                </div>
            </nav>
T
TRHX 已提交
237
        </header>                
T
TRHX 已提交
238 239
    </div>
</nav>
T
TRHX 已提交
240
      <div class="body-wrap"><article id="post-Python3 自学笔记 C01" class="article article-type-post" itemscope itemprop="blogPost">
T
TRHX 已提交
241 242
  
    <div class="article-meta">
T
TRHX 已提交
243
      <a href="/2018/09/10/Python3 自学笔记 C01/" class="article-date">
T
TRHX 已提交
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
      <time datetime="2018-09-10T15:55:00.947Z" itemprop="datePublished">2018-09-10</time>
</a>
    </div>
  
  <div class="article-inner">
    
      <input type="hidden" class="isFancy" />
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      Python3 自学笔记 C01
    </h1>
  

T
TRHX 已提交
261 262 263
        <div style="position:absolute; top:90px; left:30px">
      
      </div>
T
TRHX 已提交
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
      </header>
      
      <div class="article-info article-info-post">
        
    <div class="article-category tagcloud">
    <a class="article-category-link" href="/categories/Python/">Python</a>
    </div>


        
    <div class="article-tag tagcloud">
        <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/变量/">变量</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/数据类型/">数据类型</a></li></ul>
    </div>

        <div class="clearfix"></div>
      </div>
      
    
    <div class="article-entry" itemprop="articleBody">
      
          
T
TRHX 已提交
285
        <center><font color="#4094C7" size="4">Python3 自学笔记第一章【变量和简单数据类型】</font></center>
T
TRHX 已提交
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342

<hr>
<h1 id="1-1变量的命名和使用"><a href="#1-1变量的命名和使用" class="headerlink" title=" - 1.1变量的命名和使用 "></a><font color="#FF0000"> - 1.1变量的命名和使用 </font></h1><blockquote>
<p>变量名只能包含字母、数字和下划线。变量名可以字母或者下划线打头,但不能以数字开头,例如,可以将变量命名为message_1,但不能将其命名为1_message</p>
</blockquote>
<blockquote>
<p>变量名不能包含空格,但可使用下划线来分割其中的单词,例如,变量名greeting_message可行,但变量名greeting message会引发错误</p>
</blockquote>
<blockquote>
<p>不要将Python关键字和函数名用作变量名,即不要使用Python保留用于特殊用途的单词,如print</p>
</blockquote>
<blockquote>
<p>变量名应既简短又具有描述性,例如,name比n好,student_name比s_n好,name_length比length_of_persons_name好</p>
</blockquote>
<blockquote>
<p>慎用小写字母l和大写字母O,因为它们可能被人看错成数字1和0</p>
</blockquote>
<h1 id="1-2字符串"><a href="#1-2字符串" class="headerlink" title=" - 1.2字符串 "></a><font color="#FF0000"> - 1.2字符串 </font></h1><p> 字符串就是一系列字符,在Python中,用引号括起来的都是字符串,其中的引号可以是单引号也可以双引号:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">"This is a string."</span></span><br><span class="line"><span class="string">'This is also a string.'</span></span><br></pre></td></tr></table></figure>
<p>这种灵活性让我们能够在字符串中包含引号和撇号:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">'I told my friend,"Python is my favorite language!"'</span></span><br><span class="line"><span class="string">"The language 'Python' is named er Monty Python,not the snake."</span></span><br><span class="line"><span class="string">"One of Python's strengths is i diverse and supportive community."</span></span><br></pre></td></tr></table></figure>
<h1 id="1-2-1使用方法修改字符串的大小写"><a href="#1-2-1使用方法修改字符串的大小写" class="headerlink" title=" - 1.2.1使用方法修改字符串的大小写"></a><font color="#FF0000"> - 1.2.1使用方法修改字符串的大小写</font></h1><p>三种处理方法如下:<br><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">title()     <span class="comment">#将字符串每个单词的首字母都改为大写</span></span><br><span class="line">upper()     <span class="comment">#将字符串的每个字母都改为大写</span></span><br><span class="line">lower()     <span class="comment">#将字符串的每个字母都改为小写</span></span><br></pre></td></tr></table></figure></p>
<p>例如:<br><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">message = <span class="string">"I love you!"</span></span><br><span class="line">print(name.title())</span><br><span class="line">print(name.upper())</span><br><span class="line">print(name.lower())</span><br></pre></td></tr></table></figure></p>
<p>输出结果如下:<br><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">I Love You!</span><br><span class="line">I LOVE YOU!</span><br><span class="line">i love you!</span><br></pre></td></tr></table></figure></p>
<h1 id="1-2-2合并(拼接)字符串"><a href="#1-2-2合并(拼接)字符串" class="headerlink" title=" - 1.2.2合并(拼接)字符串"></a><font color="#FF0000"> - 1.2.2合并(拼接)字符串</font></h1><p>Python使用加号(+)来合并字符串,举例说明:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">first_name = <span class="string">"I"</span></span><br><span class="line">second_name = <span class="string">"love"</span></span><br><span class="line">third_name = <span class="string">"python"</span></span><br><span class="line">full_name = first_name + <span class="string">" "</span> + second_name + <span class="string">" "</span> + third_time</span><br><span class="line">print(full_name.title() + <span class="string">"!"</span>)</span><br></pre></td></tr></table></figure>
<p>输出结果如下:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">I Love Python!</span><br></pre></td></tr></table></figure>
<h1 id="1-2-3使用制表符或换行符来添加空白"><a href="#1-2-3使用制表符或换行符来添加空白" class="headerlink" title=" - 1.2.3使用制表符或换行符来添加空白"></a><font color="#FF0000"> - 1.2.3使用制表符或换行符来添加空白</font></h1><p>添加横向制表符:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">&gt;&gt;&gt;print(<span class="string">"\tPython"</span>)</span><br><span class="line">    Python</span><br></pre></td></tr></table></figure>
<p>添加换行符:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">&gt;&gt;&gt;print(<span class="string">"C\nC++\nPython\nJavaScript"</span>)</span><br><span class="line">C</span><br><span class="line">C++</span><br><span class="line">Python</span><br><span class="line">JavaScript</span><br></pre></td></tr></table></figure>
<center><font color="#FF0000"> 附表:Python转义符 </font><br><br><img src="https://i.imgur.com/Do9ja5A.png" alt=""><br><br></center>

<h1 id="1-2-4删除空白"><a href="#1-2-4删除空白" class="headerlink" title=" - 1.2.4删除空白"></a><font color="#FF0000"> - 1.2.4删除空白</font></h1><p>在Python中可用 lstrip()、rstrip()、strip() 分别删除字符串开头、结尾、全部的空白,举例说明:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">&gt;&gt;&gt;message = <span class="string">' python '</span></span><br><span class="line">&gt;&gt;&gt;message</span><br><span class="line"><span class="string">' python '</span></span><br><span class="line">&gt;&gt;&gt;message.lstrip()</span><br><span class="line"><span class="string">'python '</span></span><br><span class="line">&gt;&gt;&gt;message.rstrip()</span><br><span class="line"><span class="string">' python'</span></span><br><span class="line">&gt;&gt;&gt;message.strip()</span><br><span class="line"><span class="string">'python'</span></span><br></pre></td></tr></table></figure>
<p>如果要永久删除字符串中的空白,必须将删除操作的结果存回到变量中:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&gt;&gt;&gt;message = <span class="string">' python '</span></span><br><span class="line">&gt;&gt;&gt;message = message.strip()</span><br><span class="line">&gt;&gt;&gt;message</span><br><span class="line"><span class="string">'python'</span></span><br></pre></td></tr></table></figure>
<h1 id="1-3数字"><a href="#1-3数字" class="headerlink" title=" - 1.3数字"></a><font color="#FF0000"> - 1.3数字</font></h1><p>在编程中,经常使用数字来记录游戏得分、表示可视化数据、储存Web应用信息等。Python根据数字的用法以不同的方式处理它们</p>
<h1 id="1-3-1整数"><a href="#1-3-1整数" class="headerlink" title=" - 1.3.1整数"></a><font color="#FF0000"> - 1.3.1整数</font></h1><p>在Python中,可对整数执行加(+)减(-)乘(*)除(/)乘方(**)运算,同时也支持运算次序:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">&gt;&gt;&gt;<span class="number">3</span> + <span class="number">2</span></span><br><span class="line"><span class="number">5</span></span><br><span class="line">&gt;&gt;&gt;<span class="number">3</span> - <span class="number">2</span></span><br><span class="line"><span class="number">1</span></span><br><span class="line">&gt;&gt;&gt;<span class="number">3</span> * <span class="number">2</span></span><br><span class="line"><span class="number">6</span></span><br><span class="line">&gt;&gt;&gt;<span class="number">3</span> \ <span class="number">2</span></span><br><span class="line"><span class="number">1.5</span></span><br><span class="line">&gt;&gt;&gt;<span class="number">3</span> ** <span class="number">2</span></span><br><span class="line"><span class="number">9</span></span><br><span class="line">&gt;&gt;&gt;<span class="number">3</span> ** <span class="number">3</span></span><br><span class="line"><span class="number">27</span></span><br><span class="line">&gt;&gt;&gt;<span class="number">2</span> + <span class="number">3</span> * <span class="number">4</span></span><br><span class="line"><span class="number">14</span></span><br><span class="line">&gt;&gt;&gt;(<span class="number">2</span> + <span class="number">3</span>) * <span class="number">4</span></span><br><span class="line"><span class="number">20</span></span><br></pre></td></tr></table></figure>
<h1 id="1-3-2浮点数"><a href="#1-3-2浮点数" class="headerlink" title=" - 1.3.2浮点数"></a><font color="#FF0000"> - 1.3.2浮点数</font></h1><p>Python将带小数点的数字都称为浮点数:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&gt;&gt;&gt;<span class="number">0.1</span> + <span class="number">0.1</span></span><br><span class="line"><span class="number">0.2</span></span><br><span class="line">&gt;&gt;&gt;<span class="number">2</span> * <span class="number">0.2</span></span><br><span class="line"><span class="number">0.4</span></span><br></pre></td></tr></table></figure>
<p>需要注意的是,结果包含的小数位可能是不确定的,就现在而言,暂时忽略多余的小数位即可:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&gt;&gt;&gt;<span class="number">0.2</span> + <span class="number">0.1</span></span><br><span class="line"><span class="number">0.30000000000000004</span></span><br><span class="line">&gt;&gt;&gt;<span class="number">3</span> * <span class="number">0.1</span></span><br><span class="line"><span class="number">0.30000000000000004</span></span><br></pre></td></tr></table></figure>
<h1 id="1-3-3使用函数-str-避免错误"><a href="#1-3-3使用函数-str-避免错误" class="headerlink" title=" - 1.3.3使用函数 str() 避免错误"></a><font color="#FF0000"> - 1.3.3使用函数 str() 避免错误</font></h1><p>错误例子:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">age = <span class="number">23</span></span><br><span class="line">message = <span class="string">"Happy "</span> + age + <span class="string">"rd Birthday!"</span></span><br><span class="line">print(message)</span><br></pre></td></tr></table></figure>
<p>运行时会报错:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">Traceback (most recent call last):</span><br><span class="line">  File <span class="string">"birthday.py"</span>, line <span class="number">2</span>, <span class="keyword">in</span> &lt;module&gt;</span><br><span class="line">    message = <span class="string">"Happy "</span> + age + <span class="string">"rd Birthday!"</span></span><br><span class="line">TypeError: must be str, <span class="keyword">not</span> int</span><br></pre></td></tr></table></figure>
<p>这是一个类型错误,意味着Python无法识别我们使用的信息。在这个例子中,Python发现我们使用了一个值为整数(int)的变量,但它不知道该如何解读这个值,这个变量表示的可能是数值23,也可能是字符2和3。像上面这样的字符串中使用整数时,需要显式地指出我们希望Python将这个整数用作字符串。为此,可调用函数 str(),它让Python将非字符串值表示为字符串:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">age = <span class="number">23</span></span><br><span class="line">message = <span class="string">"Happy "</span> + str(age) + <span class="string">"rd Birthday!"</span></span><br><span class="line">print(message)</span><br></pre></td></tr></table></figure>
<p>输出结果如下:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Happy <span class="number">23</span>rd Birthday!</span><br></pre></td></tr></table></figure>
<h1 id="1-4注释"><a href="#1-4注释" class="headerlink" title=" - 1.4注释"></a><font color="#FF0000"> - 1.4注释</font></h1><p>注释让我们能够使用自然语言在程序中添加说明,Python中注释有三种方法:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">print(<span class="string">"Hello Python!"</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment">#这是单行注释</span></span><br><span class="line"></span><br><span class="line"><span class="string">'''这是多行注释</span></span><br><span class="line"><span class="string">这是多行注释'''</span></span><br><span class="line"></span><br><span class="line"><span class="string">"""这也是多行注释</span></span><br><span class="line"><span class="string">这也是多行注释"""</span></span><br></pre></td></tr></table></figure>

      
T
TRHX 已提交
343
      
T
TRHX 已提交
344 345 346 347 348 349
    </div>
    
  </div>
  
    
    <div class="copyright">
T
TRHX 已提交
350
        <p><span>本文标题:</span><a href="/2018/09/10/Python3 自学笔记 C01/">Python3 自学笔记 C01</a></p>
T
TRHX 已提交
351
        <p><span>文章作者:</span><a href="/" title="访问 TRHX 的个人博客">TRHX</a></p>
T
TRHX 已提交
352
        <p><span>发布时间:</span>2018年09月10日 - 23时55分</p>
T
TRHX 已提交
353
        <p><span>最后更新:</span>2018年09月16日 - 01时09分</p>
T
TRHX 已提交
354
        <p>
T
TRHX 已提交
355 356
            <span>原始链接:</span><a class="post-url" href="/2018/09/10/Python3 自学笔记 C01/" title="Python3 自学笔记 C01">https://trhx.top/2018/09/10/Python3 自学笔记 C01/</a>
            <span class="copy-path" data-clipboard-text="原文: https://trhx.top/2018/09/10/Python3 自学笔记 C01/  作者: TRHX" title="点击复制文章链接"><i class="fa fa-clipboard"></i></span>
T
TRHX 已提交
357 358
            <script src="/js/clipboard.min.js"></script>
            <script> var clipboard = new Clipboard('.copy-path'); </script>
T
TRHX 已提交
359 360
        </p>
        <p>
T
TRHX 已提交
361
            <span>许可协议:</span>本作品采用 <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" title="国际 (CC BY-NC-SA 4.0)" target = "_blank">知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议</a> 进行许可
T
TRHX 已提交
362 363 364 365 366 367 368
        </p>
    </div>



<nav id="article-nav">
  
T
TRHX 已提交
369
    <a href="/2018/09/15/Python3 自学笔记 C02/" id="article-nav-newer" class="article-nav-link-wrap">
T
TRHX 已提交
370 371 372 373 374 375 376 377
      <strong class="article-nav-caption"><</strong>
      <div class="article-nav-title">
        
          Python3 自学笔记 C02
        
      </div>
    </a>
  
T
TRHX 已提交
378
  
T
TRHX 已提交
379
    <a href="/2018/09/09/VMware Pro 14 安装 Ubuntu 18.04 详细教程/" id="article-nav-older" class="article-nav-link-wrap">
T
TRHX 已提交
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
      <div class="article-nav-title">VMware Pro 14 安装 Ubuntu 18.04 详细教程</div>
      <strong class="article-nav-caption">></strong>
    </a>
  
</nav>

  
</article>

    <div id="toc" class="toc-article">
    <strong class="toc-title">文章目录</strong>
    <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#1-1变量的命名和使用"><span class="toc-number">1.</span> <span class="toc-text"> - 1.1变量的命名和使用 </span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#1-2字符串"><span class="toc-number">2.</span> <span class="toc-text"> - 1.2字符串 </span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#1-2-1使用方法修改字符串的大小写"><span class="toc-number">3.</span> <span class="toc-text"> - 1.2.1使用方法修改字符串的大小写</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#1-2-2合并(拼接)字符串"><span class="toc-number">4.</span> <span class="toc-text"> - 1.2.2合并(拼接)字符串</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#1-2-3使用制表符或换行符来添加空白"><span class="toc-number">5.</span> <span class="toc-text"> - 1.2.3使用制表符或换行符来添加空白</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#1-2-4删除空白"><span class="toc-number">6.</span> <span class="toc-text"> - 1.2.4删除空白</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#1-3数字"><span class="toc-number">7.</span> <span class="toc-text"> - 1.3数字</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#1-3-1整数"><span class="toc-number">8.</span> <span class="toc-text"> - 1.3.1整数</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#1-3-2浮点数"><span class="toc-number">9.</span> <span class="toc-text"> - 1.3.2浮点数</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#1-3-3使用函数-str-避免错误"><span class="toc-number">10.</span> <span class="toc-text"> - 1.3.3使用函数 str() 避免错误</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#1-4注释"><span class="toc-number">11.</span> <span class="toc-text"> - 1.4注释</span></a></li></ol>
</div>
<input type="button" id="tocButton" value="隐藏目录"  title="点击按钮隐藏或者显示文章目录">

T
TRHX 已提交
395
<script src="https://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js"></script>
T
TRHX 已提交
396 397 398
<script>
    var valueHide = "隐藏目录";
    var valueShow = "显示目录";
T
TRHX 已提交
399

T
TRHX 已提交
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
    if ($(".left-col").is(":hidden")) {
        $("#tocButton").attr("value", valueShow);
    }
    $("#tocButton").click(function() {
        if ($("#toc").is(":hidden")) {
            $("#tocButton").attr("value", valueHide);
            $("#toc").slideDown(320);
        }
        else {
            $("#tocButton").attr("value", valueShow);
            $("#toc").slideUp(350);
        }
    })
    if ($(".toc").length < 1) {
        $("#toc, #tocButton").hide();
    }
</script>





T
TRHX 已提交
422

T
TRHX 已提交
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453
    <link rel="stylesheet" type="text/css" href="/css/showshare.css"></head>
    <div id="share" class="bdsharebuttonbox">
        <button class="share-toggle-button"><i class="share-icon fa fa-share-alt"></i>
        </button>
        <ul class="share-items">
            <li class="share-item"><a href="#" class="share-button fa fa-weibo" data-cmd="tsina" title="分享到新浪微博"></a></li>
            <li class="share-item"><a href="#" class="share-button fa fa-weixin" data-cmd="weixin" title="分享到微信"></a></li>
            <li class="share-item"><a href="#" class="share-button fa fa-qq" data-cmd="sqq" title="分享到QQ好友"></a></li>
            <li class="share-item"><a href="#" class="share-button fa fa-facebook" data-cmd="fbook" title="分享到Facebook"></a></li>
            <li class="share-item"><a href="#" class="share-button fa fa-twitter" data-cmd="twi" title="分享到Twitter"></a></li>
            <li class="share-item"><a href="#" class="share-button fa fa-linkedin" data-cmd="linkedin" title="分享到linkedin"></a></li>
        </ul>
    </div>
    <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="800">
        <defs>
            <filter id="goo">
                <feGaussianBlur in="SourceGraphic" stdDeviation="12" result="blur" />
                <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 35 -15" result="goo" />
                <feComposite in="SourceGraphic" in2="goo" operator="atop"/>
            </filter>
        </defs>
    </svg>
    <!-- 推荐开源CDN来选取需引用的外部JS //-->
    <script type="text/javascript" src="http://cdn.gbtags.com/jquery/1.11.1/jquery.min.js"></script>
    <script src="/js/TweenMax.min.js"></script>
    <script src="/js/TweenMax.js"></script>
<script>
    window._bd_share_config = {
    common : {
                    bdText : '',
                    //文本内容
T
TRHX 已提交
454
                    bdDesc : '业余单车运动员、菜鸟级软件工程大学生、爱折腾、爱刺激、爱编程、爱科技',
T
TRHX 已提交
455
                    // 描述
T
TRHX 已提交
456
                    bdUrl : 'http://trhx.top',
T
TRHX 已提交
457
                    // URL地址
T
TRHX 已提交
458
                    bdPic : 'https://i.imgur.com/2VWhI8A.png'
T
TRHX 已提交
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478
                    // 图片信息
                },
        share: [{
            "bdSize": 24
        }]
    }
    with(document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion=' + ~ (-new Date() / 36e5)];
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-33765729-1']);
    _gaq.push(['_setDomainName', 'chuanke.com']);
    _gaq.push(['_trackPageview']);
    (function() {
        var ga = document.createElement('script');
        ga.type = 'text/javascript';
        ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(ga, s);
    })();
</script>
T
TRHX 已提交
479 480 481


    
T
TRHX 已提交
482
        <!-- 来必力City版安装代码 -->
T
TRHX 已提交
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505
<div id="lv-container" data-id="city" data-uid="MTAyMC8zOTA3MS8xNTU5OA==">
  <script type="text/javascript">
     (function(d, s) {
         var j, e = d.getElementsByTagName(s)[0];
  
         if (typeof LivereTower === 'function') { return; }
  
         j = d.createElement(s);
         j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
         j.async = true;
  
         e.parentNode.insertBefore(j, e);
     })(document, 'script');
  </script>
  <noscript>为正常使用来必力评论功能请激活JavaScript</noscript>
  </div>
  <!-- City版安装代码已完成 -->
    



    <div class="scroll" id="post-nav-button">
        
T
TRHX 已提交
506
            <a href="/2018/09/15/Python3 自学笔记 C02/" title="上一篇: Python3 自学笔记 C02">
T
TRHX 已提交
507 508
                <i class="fa fa-angle-left"></i>
            </a>
T
TRHX 已提交
509 510 511
        
        <a title="文章列表"><i class="fa fa-bars"></i><i class="fa fa-times"></i></a>
        
T
TRHX 已提交
512
            <a href="/2018/09/09/VMware Pro 14 安装 Ubuntu 18.04 详细教程/" title="下一篇: VMware Pro 14 安装 Ubuntu 18.04 详细教程">
T
TRHX 已提交
513 514 515 516
                <i class="fa fa-angle-right"></i>
            </a>
        
    </div>
T
TRHX 已提交
517
    <ul class="post-list"><li class="post-list-item"><a class="post-list-link" href="/2018/11/16/Python3 自学笔记 C09/">Python3 自学笔记 C09</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/11/10/Python3 自学笔记 C08/">Python3 自学笔记 C08</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/11/03/Python3 自学笔记 C07/">Python3 自学笔记 C07</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/10/30/Python3 自学笔记 C06/">Python3 自学笔记 C06</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/10/27/Python3 自学笔记 C05/">Python3 自学笔记 C05</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/10/23/Python3 自学笔记 C04/">Python3 自学笔记 C04</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/10/11/Python3 自学笔记 C03/">Python3 自学笔记 C03</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/09/15/Python3 自学笔记 C02/">Python3 自学笔记 C02</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/09/10/Python3 自学笔记 C01/">Python3 自学笔记 C01</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/09/09/VMware Pro 14 安装 Ubuntu 18.04 详细教程/">VMware Pro 14 安装 Ubuntu 18.04 详细教程</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/08/29/主流 Markdown 编辑器推荐/">主流 Markdown 编辑器推荐</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/08/27/Hexo 博客主题个性化/">Hexo 博客主题个性化</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/08/25/Markdown 语法&技巧总结/">Markdown 语法&技巧总结</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/08/15/如何使用Github Pages和Hexo搭建自己独立博客/">如何使用 Github Pages 和 Hexo 搭建自己的独立博客</a></li><li class="post-list-item"><a class="post-list-link" href="/2018/08/10/Hello World/">Hello World!</a></li></ul>
T
TRHX 已提交
518
    <script src="https://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js"></script>
T
TRHX 已提交
519 520
    <script>
        $(".post-list").addClass("toc-article");
T
TRHX 已提交
521
        $(".post-list-item a").attr("target","_blank");
T
TRHX 已提交
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547
        $("#post-nav-button > a:nth-child(2)").click(function() {
            $(".fa-bars, .fa-times").toggle();
            $(".post-list").toggle(300);
            if ($(".toc").length > 0) {
                $("#toc, #tocButton").toggle(200, function() {
                    if ($(".switch-area").is(":visible")) {
                        $("#tocButton").attr("value", valueHide);
                        }
                    })
            }
            else {
            }
        })
    </script>



    <script>
        
    </script>
</div>
      <footer id="footer">
    <div class="outer">
        <div id="footer-info">
            <div class="footer-left">
                &copy; 2018 <a href="http://trhx.top" target="_blank"> TRHX </a>
T
TRHX 已提交
548 549 550 551 552
                <span>
                <i class="fa fa-italic"> </i>
                <i class="fa fa-heartbeat"> </i>
                <i class="fa fa-yahoo"> </i>
                </span>
T
TRHX 已提交
553 554 555
            </div>
            <div class="footer-right">
                <span><i class="fa fa-paw"> </i></span>
T
TRHX 已提交
556
                <a href="http://hexo.io/" target="_blank">Hexo</a>  Theme spfk by <a href="https://github.com/luuman/hexo-theme-spfk" target="_blank">luuman</a>
T
TRHX 已提交
557 558
                <span><i class="fa fa-paw"> </i></span>
            </div>
T
TRHX 已提交
559 560 561 562 563
        </div>
        
            <div class="visit">
                
                    <span id="busuanzi_container_site_pv" style='display:none'>
T
TRHX 已提交
564 565
                    <span><i class="fa fa-spinner fa-spin"> </i></span>
                        <font color=#4094C7>
T
TRHX 已提交
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584
                            <span id="timeDate">载入天数...</span><span id="times">载入时分秒...</span> 
                            <script> 
                                var now = new Date(); 
                                function createtime() 
                                { 
                                  var grt= new Date("08/10/2018 17:38:00");//此处修改你的建站时间或者网站上线时间 
                                  now.setTime(now.getTime()+250); 
                                  days = (now - grt ) / 1000 / 60 / 60 / 24; dnum = Math.floor(days); 
                                  hours = (now - grt ) / 1000 / 60 / 60 - (24 * dnum); hnum = Math.floor(hours); 
                                  if(String(hnum).length ==1 ){hnum = "0" + hnum;} minutes = (now - grt ) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum); 
                                  mnum = Math.floor(minutes); if(String(mnum).length ==1 ){mnum = "0" + mnum;} 
                                  seconds = (now - grt ) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum); 
                                  snum = Math.round(seconds); if(String(snum).length ==1 ){snum = "0" + snum;} 
                                  document.getElementById("timeDate").innerHTML = " 本站已运行 "+dnum+""; 
                                  document.getElementById("times").innerHTML = hnum + " 小时 " + mnum + "" + snum + ""; 
                                } 
                                setInterval("createtime()",250); 
                            </script>
                        </font>
T
TRHX 已提交
585 586 587
                        <span>
                         <i class="fa fa-paper-plane"> </i>
                        </span>
T
TRHX 已提交
588 589 590 591 592 593
                        <span id="site-visit" >本站到访数: 
                            <span id="busuanzi_value_site_uv"></span>
                        </span>
                    </span>
                
                
T
TRHX 已提交
594 595 596
                    <span>
                         <i class="fa fa-paper-plane"> </i>
                    </span>
T
TRHX 已提交
597 598 599 600 601
                
                
                    <span id="busuanzi_container_page_pv" style='display:none'>
                        <span id="page-visit">本页阅读量: 
                            <span id="busuanzi_value_page_pv"></span>
T
TRHX 已提交
602 603
                            <span id="busuanzi_value_page_pv"></span>
                            <span><i class="fa fa-spinner fa-spin"> </i></span>
T
TRHX 已提交
604 605 606 607 608 609 610
                        </span>
                    </span>
                
            </div>
        
    </div>
</footer>
T
TRHX 已提交
611 612
    </div>
    <script src="https://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js"></script>
T
TRHX 已提交
613 614 615 616
<script src="/js/main.js"></script>

    <script>
        $(document).ready(function() {
T
TRHX 已提交
617
            var backgroundnum = 52;
T
TRHX 已提交
618
            var backgroundimg = "url(/background/bg-x.jpg)".replace(/x/gi, Math.ceil(Math.random() * backgroundnum));
T
TRHX 已提交
619 620 621 622 623 624 625 626
            $("#mobile-nav").css({"background-image": backgroundimg,"background-size": "cover","background-position": "center"});
            $(".left-col").css({"background-image": backgroundimg,"background-size": "cover","background-position": "center"});
        })
    </script>




T
TRHX 已提交
627
	<script>
T
TRHX 已提交
628 629 630 631 632 633 634 635
		var _hmt = _hmt || [];
		(function() {
			var hm = document.createElement("script");
			hm.src = "https://hm.baidu.com/hm.js?68019af241ffe13fed16341dc16acd4f";
			var s = document.getElementsByTagName("script")[0]; 
			s.parentNode.insertBefore(hm, s);
		})();
		</script>
T
TRHX 已提交
636

T
TRHX 已提交
637 638 639 640 641 642 643 644 645 646 647 648 649 650

<div class="scroll" id="scroll">
    <a href="#"><i class="fa fa-arrow-up"></i></a>
    <a href="#comments"><i class="fa fa-comments-o"></i></a>
    <a href="#footer"><i class="fa fa-arrow-down"></i></a>
</div>
<script>
    $(document).ready(function() {
        if ($("#comments").length < 1) {
            $("#scroll > a:nth-child(2)").hide();
        };
    })
</script>

T
TRHX 已提交
651 652
<link rel="stylesheet" href="//cdn.bootcss.com/font-awesome/4.3.0/css/font-awesome.min.css">
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js">
T
TRHX 已提交
653 654 655
</script>


T
TRHX 已提交
656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672
    <script type="text/javascript">
      window.onload = function(){
        document.getElementById("search").onclick = function(){
            console.log("search")
            search();
        }
      }
      function search(){
        (function(w,d,t,u,n,s,e){w['SwiftypeObject']=n;w[n]=w[n]||function(){
        (w[n].q=w[n].q||[]).push(arguments);};s=d.createElement(t);
        e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
        })(window,document,'script','//s.swiftypecdn.com/install/v2/st.js','_st');

        _st('install','A1Pz-LKMXbrzcFg2FWi6','2.0.0');
      }
    </script>

T
TRHX 已提交
673
  </div>
T
TRHX 已提交
674
</body>
T
TRHX 已提交
675 676
</html>

T
TRHX 已提交
677 678 679 680 681
<!--动态线条背景-->
<script type="text/javascript"
color="220,220,220" opacity='0.7' zIndex="-2" count="220" src="//cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js">
</script>

T
TRHX 已提交
682 683 684
<!--单击显示文字-->
<script type="text/javascript" src="/js/click_show_text.js"></script>

T
TRHX 已提交
685 686
<!--浏览器搞笑标题-->
<script type="text/javascript" src="\js\FunnyTitle.js"></script>