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
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
패키지 검색
$ apt-cache search <패키지 이름>
패키지 정보보기
$ apt-cache show <패키지 이름>
$ apt-cache show openssh-server
패키지 소스 리스트 갱신(upgrade 를 하기 전에 update 해서 /etc/apt/source.list 를 갱신)
$ sudo apt-get update
설치된 패키지 업그레이드
$ sudo apt-get upgrade
패키지 설치
$ sudo apt-get install <패키지 이름>
패키지 제거
$ sudo apt-get remove <패키지 이름>
패키지 재설치(주로 소프트웨어가 잘못되어 있을 때 사용)
$ sudo apt-get reinstall <패키지 이름>
apt-get install 명령어로 설치한 패키지(deb) 파일의 삭제
$ sudo apt-get clean
경로(/var/cache/apt/archives)에 .deb 패키지 파일로 저장되어 있다.
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()