分类 Python 下的文章
Python之变量和打印
#coding:utf-8
name = 'Zed A. Shaw'
age = 8.123 # not a lie
height = 74 # inches
weight = 180 # lbs
eyes = 'Blue'
teeth = 'White'
hair = 'Brown'
print "His name is %s" %name
这里可以将常量也以这种方式打印出来
python获取正在运行的KVM ID
# -*- coding: utf-8 -*-
#!/usr/bin/python
import os
import re
mykvm=os.popen('virsh list').readlines()
for line in kymvm:
kvmid=re.search( r'kvm.[0-9]\d*', line)
if kvmid:
print kvmid.group()
centos下安装pip
首先安装 epel扩展源:
yum -y install epel-release
然后安装pip:
yum -y install python-pip