>>> s.split(' ')
['Rajasekar', 'SP', '', 'def']
>>> s.split()
['Rajasekar', 'SP', 'def']
>>> s.partition(' ')
('Rajasekar', ' ', 'SP def')
from werkzeug.contrib.cache import RedisCache
cache = RedisCache(host='127.0.0.1',port=6379,db=4)
cache.set('my-item', 'value',timeout=50)
cache.get('my-item')
upstream uwsgicluster { server 127.0.0.1:9001; server 192.168.100.101:9001; server 192.168.100.102:9001; server 192.168.100.103:9001; server 192.168.100.104:9001; } server { listen 80; server_name www.example.com example.com; access_log /srv/www/example.com/logs/access.log; error_log /srv/www/example.com/logs/error.log; location / { include uwsgi_params; uwsgi_pass uwsgicluster; } location /static { root /srv/www/example.com/public_html/static/; index index.html index.htm; } }
python 설치
add-apt-repository ppa:fkrull/deadsnakes
apt-get update
apt-get install python3.4
pip 설치
get https://bootstrap.pypa.io/get-pip.py
python3.4 get-pip.py
if type(val) is dict: if 'T' in obj: if 'response' not in jsonData.keys(): if not token: if token['userid'] is None:
if 'response' not in jsonData.keys():
except pycurl.error as e: print(e)
# dict 형태로 row를 반환
cursor = db.cursor(pymysql.cursors.DictCursor)
cursor.execute("SELECT id, name FROM `table`")
rows=cursor.fetchall()
cursor.execute("SELECT id, name FROM `table`")
for i in xrange(cursor.rowcount):
id, name = cursor.fetchone()
print id, name
cursor.execute("SELECT id, name FROM `table`")
result = cursor.fetchmany()
while result:
for id, name in result:
print id, name
result = cursor.fetchmany()
cursor.execute("SELECT id, name FROM `table`")
for id, name in cursor.fetchall():
print id, name
import MySQLdb
conn = MySQLdb.connect(user="user", passwd="password", db="mydb")
cur = conn.cursor()
print "Executing query"
cur.execute("SELECT * FROM bigtable");
print "Starting loop"
row = cur.fetchone()
while row is not None:
print ", ".join([str(c) for c in row])
row = cur.fetchone()
cur.close()
conn.close()