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
>>>