Skip to content

Commit fb8b9e0

Browse files
committedFeb 22, 2018
* more examples
1 parent 7c8a88c commit fb8b9e0

File tree

10 files changed

+59
-0
lines changed

10 files changed

+59
-0
lines changed
 

‎core_class/del.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env python
2+
3+
class FooType(object):
4+
5+
def __del__(self):
6+
print 'Good by'
7+
8+
print 'Make instance...'
9+
10+
ft = FooType();
11+
12+
print 'End...'

‎core_class/init.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env python
2+
3+
class FooType(object):
4+
def __init__(self, id):
5+
self.id = id
6+
print self.id, 'born'
7+
8+
print 'Make instance...'
9+
10+
ft = FooType(1)
11+
12+
print 'End...'

‎core_for/test01.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/python
2+
3+
for i in xrange(10):
4+
print ( 'tra la la', i )

‎core_for/test02.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/python
2+
3+
for i in xrange(4, 10):
4+
print ( 'tra la la', i )

‎core_for/test04.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/python
2+
3+
for i in xrange(4, 10,2):
4+
print ( 'tra la la', i )

‎core_types/list/append.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
x = [1, 2, 3]
2+
print (x)
23
x.append([4, 5])
34
print (x)
45

6+
x.append(4)
7+
print (x)
8+

‎json/test.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import json
2+
print '***************'
3+
print json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}], indent=4)
4+
print '***************'
5+
print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys = True, indent=4 )
6+
print '***************'
7+
print json.dumps( {'4': 5, '6': 7}, indent=4)
8+
print '***************'

‎lib_os/os_environ.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
import os
2+
print os.environ["PATH"]
3+
print "---------"
24
print os.environ

‎lib_os/os_getcwd.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import os
2+
print "Current working folder is: "
3+
print os.getcwd()

‎sys_arg/test01.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/python
2+
# URL: https://www.tutorialspoint.com/python/python_command_line_arguments.htm
3+
import sys
4+
5+
print 'Number of arguments:', len(sys.argv), 'arguments.'
6+
print 'Argument List:', str(sys.argv)

0 commit comments

Comments
 (0)
Please sign in to comment.