-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_popen.py
More file actions
47 lines (38 loc) · 983 Bytes
/
test_popen.py
File metadata and controls
47 lines (38 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- coding: utf-8 -*-
import logging
import logging.config
logging.config.fileConfig("logger.conf")
logger = logging.getLogger("example01")
logger = logging.getLogger()
logger.debug('This is debug message')
logger.info('This is info message')
logger.warning('This is warning message')
a = ['a', 'b']
if ('c' not in a):
print('ddd')
else:
print('ok')
def execCmd(cmd):
import os
try:
f = open('jdkkf/fkgkg\history.txt','w')
r = os.popen(cmd)
text = r.read()
r.close()
return text
except Exception as e:
print('Exception: %s' % e)
#execCmd('dkdk')
def test_reduce():
l=['adam', 'LISA', 'barT']
from functools import reduce
s = reduce(lambda x,y: x+' '+y, l)
print(s)
def test_arg():
import sys
botname = 'ade'
print(len(sys.argv))
if len(sys.argv) > 1:
for arg in sys.argv[1:]:
print(arg)
test_arg()