发布时间:2015-09-17 17:01:27
#coding=utf-8<br /># Area calculation program<br />print ("Welcome to the Area calculation program")<br />print ("*********************************")<br />print<br /># Print out the menu:<br />print ("Please select a shape:")<br />print ("1 Rectangle")<br />print ("2 Circle")<br />#Get the .........【阅读全文】
发布时间:2015-09-15 16:59:54
#!/usr/bin/env python<br />#encoding:UTF-8<br /> <br />import urllib.parse<br />import urllib.request<br />def get():<br /> url=''<br /> data=urllib.request.urlopen(url).read() <br /> z_data=data.decode('UTF-8')<br /> print.........【阅读全文】
发布时间:2015-08-10 16:35:13
<pre><span class="k">def</span> <span class="nf">all</span><span class="p">(</span><span class="n">iterable</span><span class="p">):</span> </pre><pre><span class="k"> for</span> <span class="n">element</span> <span class="ow">in</span> <span class="......【阅读全文】
发布时间:2015-08-04 19:40:23
1.list 定义<br />>>> li = ["a", "b", "mpilgrim", "z", "example"] >>> li ['a', 'b', 'mpilgrim', 'z', 'example'] >>> li[1] 'b'<br />1.list 负数索引<br />>>> li ['a', 'b', 'mpilgrim', 'z', 'example'] >>> li[-1] 'example' >>> li[-3] 'mpilgrim' >.........【阅读全文】
发布时间:2015-08-04 19:30:50
<pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="color:#000080;font-weight:bold;">import </span>calendarmonthRange = calendar.monthrange(<span style="color:#0000ff;">2013</span>,<span style="color:#0000ff;">6</span>) </pre><pre style="background-color:#FFFFF.........【阅读全文】
发布时间:2015-08-03 11:40:22
<pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="background-color:#ffe4ff;">str</span> = <span style="color:#008080;font-weight:bold;">"www.runoob.com" </span></pre><pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="color:#000.........【阅读全文】
发布时间:2015-08-03 11:31:47
<pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="color:#808080;font-style:italic;"># 写文件 </span></pre><pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="color:#000080;font-weight:bold;">with </span><span style="color:#00008.........【阅读全文】
发布时间:2015-08-03 11:23:49
<pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="color:#808080;font-style:italic;"># 引入日历模块 </span></pre><pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="color:#000080;font-weight:bold;">import </span>calendar </p.........【阅读全文】
发布时间:2015-07-31 17:03:07
<pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"># 定义函数 def add(x, y): """相加""" return x + y def subtract(x, y): """相减""" return x - y def multiply(x, y): """相乘""" .........【阅读全文】
发布时间:2015-07-31 16:55:41
<pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="color:#808080;font-style:italic;"># 定义函数 </span></pre><pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="color:#000080;font-weight:bold;">def </span>lcm(x, y): </pre>.........【阅读全文】
发布时间:2015-07-30 19:58:47
<pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="color:#808080;font-style:italic;"># 用户输入字符 </span></pre><pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;">c = <span style="color:#000080;">input</span>(<span style="color:#008080;font.........【阅读全文】
发布时间:2015-07-30 19:56:10
<pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="color:#808080;font-style:italic;"># -*- coding: UTF-8 -*- </span><span style="color:#808080;font-style:italic;"> </span></pre><pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style=.........【阅读全文】
发布时间:2015-07-30 19:50:04
<pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="color:#808080;font-style:italic;"># -*- coding: UTF-8 -*- </span></pre><pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="color:#808080;font-style:italic;"># Python 检测用户输入.........【阅读全文】
发布时间:2015-07-30 19:26:35
<pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="color:#808080;font-style:italic;">#Fibonacci </span></pre><pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;">a,b=<span style="color:#0000ff;">0</span>,<span style="color:#0000ff;">1 </s.........【阅读全文】
发布时间:2015-07-25 16:33:34
<pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="color:#808080;font-style:italic;"># -*- coding: UTF-8 -*- </span><span style="color:#808080;font-style:italic;"> </span></pre><pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style=.........【阅读全文】
发布时间:2015-07-25 14:38:34
<pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style="color:#808080;font-style:italic;"># -*- coding: UTF-8 -*- </span><span style="color:#808080;font-style:italic;"> </span></pre><pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"><span style=.........【阅读全文】
发布时间:2015-07-24 14:34:16
<pre style="background-color:#FFFFFF;font-family:宋体;font-size:12pt;"># -*- coding: UTF-8 -*-# Python 程序用于检测用户输入的数字是否为质素 num = int(input("请输入一个数字: ")) # 质数大于 1 if num > 1: # 查看因子 for i in range(2,num): .........【阅读全文】