今天晚上敲得python命令
来源:互联网 发布:配料配比软件 编辑:程序博客网 时间:2024/05/01 16:24
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getcwd()
'C:\\Program Files\\UliPad'
>>> os.chdir('D:\java\python')
>>> os.getcwd()
'D:\\java\\python'
>>> import glob
>>> glob.glob('*.py')
['builtin-apply-example-1.py', 'builtin-apply-example-3.py', 'builtin-import-example-1.py', 'example-plugin.py', 'first.py', 'second.py', 'text.py', 'third.py']
>>> import sys
>>> print(sys.argv)
['C:\\Program Files\\UliPad\\UliPad.exe']
>>> python first.py one two three
File "<input>", line 1
python(first.py one two three)
^
SyntaxError: invalid syntax
>>> sys.stderr.write('warming,log file not find\n')
warming,log file not find
>>> import re
>>> 'tea for two'.replace('tea','two')
'two for two'
>>> import math
>>> math.cos(math.pi/4)
0.7071067811865476
>>> math.log(1024,2)
10.0
>>> import random
>>> random.choice(['dfg','555','vvv','rrr'])
'rrr'
>>> random.sample(range(100),10)
[74, 24, 44, 43, 83, 32, 19, 98, 54, 63]
>>> random.random()
0.016488937789392755
>>> from urllib.request import urlopen
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named request
>>> from urllib.request import urlopen
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named request
>>> from urllib import urlopen
>>> for line in urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'):
File "<input>", line 1
for line in urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'):
^
IndentationError: unexpected indent
>>> for line in urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'):
... line = line.decode('utf-8')
... if 'EST' in line or 'EDT' in line:
... print(line)
...
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "urllib.pyo", line 84, in urlopen
File "urllib.pyo", line 205, in open
File "urllib.pyo", line 342, in open_http
File "httplib.pyo", line 951, in endheaders
File "httplib.pyo", line 811, in _send_output
File "httplib.pyo", line 773, in send
File "httplib.pyo", line 754, in connect
File "socket.pyo", line 571, in create_connection
IOError: [Errno socket error] [Errno 10061]
>>> import smtplib
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named smtplib
>>> import smtplib
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named smtplib
>>> from datetime import date
>>> now = date.today()
>>> now
datetime.date(2013, 11, 19)
>>> now.strftime('%m-%d-%y. %d %b %Y is a %A on the %d day of %B.')
'11-19-13. 19 Nov 2013 is a Tuesday on the 19 day of November.'
>>> birthday = date(1964,7,31)
>>> age = now -birthday
>>> age.days
18008
>>> birthday = date(1988,4,30)
>>> age =now-birthday
>>> age.days
9334
>>> import zlib
>>> s = b'witch which has which witches wrist watch'
>>> len(s)
41
>>> t=zlib.compress(s)
>>> len(t)
37
>>> zlib.decompress(t)
'witch which has which witches wrist watch'
>>> zlib.crc32(s)
226805979
>>> from timeit import Timer
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named timeit
>>> from time import Timer
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: cannot import name Timer
>>> import timeit
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named timeit
>>>
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getcwd()
'C:\\Program Files\\UliPad'
>>> os.chdir('D:\java\python')
>>> os.getcwd()
'D:\\java\\python'
>>> import glob
>>> glob.glob('*.py')
['builtin-apply-example-1.py', 'builtin-apply-example-3.py', 'builtin-import-example-1.py', 'example-plugin.py', 'first.py', 'second.py', 'text.py', 'third.py']
>>> import sys
>>> print(sys.argv)
['C:\\Program Files\\UliPad\\UliPad.exe']
>>> python first.py one two three
File "<input>", line 1
python(first.py one two three)
^
SyntaxError: invalid syntax
>>> sys.stderr.write('warming,log file not find\n')
warming,log file not find
>>> import re
>>> 'tea for two'.replace('tea','two')
'two for two'
>>> import math
>>> math.cos(math.pi/4)
0.7071067811865476
>>> math.log(1024,2)
10.0
>>> import random
>>> random.choice(['dfg','555','vvv','rrr'])
'rrr'
>>> random.sample(range(100),10)
[74, 24, 44, 43, 83, 32, 19, 98, 54, 63]
>>> random.random()
0.016488937789392755
>>> from urllib.request import urlopen
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named request
>>> from urllib.request import urlopen
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named request
>>> from urllib import urlopen
>>> for line in urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'):
File "<input>", line 1
for line in urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'):
^
IndentationError: unexpected indent
>>> for line in urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'):
... line = line.decode('utf-8')
... if 'EST' in line or 'EDT' in line:
... print(line)
...
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "urllib.pyo", line 84, in urlopen
File "urllib.pyo", line 205, in open
File "urllib.pyo", line 342, in open_http
File "httplib.pyo", line 951, in endheaders
File "httplib.pyo", line 811, in _send_output
File "httplib.pyo", line 773, in send
File "httplib.pyo", line 754, in connect
File "socket.pyo", line 571, in create_connection
IOError: [Errno socket error] [Errno 10061]
>>> import smtplib
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named smtplib
>>> import smtplib
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named smtplib
>>> from datetime import date
>>> now = date.today()
>>> now
datetime.date(2013, 11, 19)
>>> now.strftime('%m-%d-%y. %d %b %Y is a %A on the %d day of %B.')
'11-19-13. 19 Nov 2013 is a Tuesday on the 19 day of November.'
>>> birthday = date(1964,7,31)
>>> age = now -birthday
>>> age.days
18008
>>> birthday = date(1988,4,30)
>>> age =now-birthday
>>> age.days
9334
>>> import zlib
>>> s = b'witch which has which witches wrist watch'
>>> len(s)
41
>>> t=zlib.compress(s)
>>> len(t)
37
>>> zlib.decompress(t)
'witch which has which witches wrist watch'
>>> zlib.crc32(s)
226805979
>>> from timeit import Timer
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named timeit
>>> from time import Timer
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: cannot import name Timer
>>> import timeit
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named timeit
>>>
- 今天晚上敲得python命令
- 今天晚上。。。
- 今天晚上我值班
- 今天晚上去看球了
- 今天晚上月全食
- 今天晚上回家
- 今天晚上研究一下历史
- 今天晚上吃什么
- 今天晚上捉鱼去了
- 今天晚上加班写程序
- 今天晚上之时间浪费
- 今天晚上感觉有点失落
- 今天晚上一起到外面吃饭
- 今天晚上可能要通宵了!呵呵!
- 今天晚上可能要通宵了!呵呵!
- 今天晚上去参加朋友的婚礼!
- 今天晚上参加了企业文化培训
- 今天晚上最有价值的发现
- 分区软件工具哪个好用
- java.lang.UnsatisfiedLinkError: Couldn't load detection_based_track: findLibrary returned nul
- linux中杀进程
- UVA10340
- Linux网络编程必看书籍推荐
- 今天晚上敲得python命令
- 在IReport中将Blob字段展示为图片
- UVA10487
- android权限大全
- (Relax 数论1.6)POJ 1061 青蛙的约会(扩展的欧几里得公式)
- 后缀表达式
- Cg编程
- JBoss 系列五十四:JBoss 7/WildFly 集群之 HornetQ Messaging - II(示例)
- poj1753:Flip Game