#设置歌手 mid3v2 -a "歌手" *.mp3 #设置专辑名 mid3v2 -A "专辑名" *.mp3 #用文件名标记mp3的title find -name "*.mp3" | while read file;do mid3v2 -t "`echo $file|sed -e 's/^\.\///g' -e 's/.mp3$//g'`" "$file";done
———–
post by gmail~
#设置歌手 mid3v2 -a "歌手" *.mp3 #设置专辑名 mid3v2 -A "专辑名" *.mp3 #用文件名标记mp3的title find -name "*.mp3" | while read file;do mid3v2 -t "`echo $file|sed -e 's/^\.\///g' -e 's/.mp3$//g'`" "$file";done
———–
post by gmail~
def ip2long1(ip): hexn = ''.join(["%02X" % long(i) for i in ip.split('.')]) return long(hexn, 16) def ip2long2(ip): lngip = 0 for q in ip.split('.'): lngip = (lngip << 8) | int(q) return lngip if __name__ == '__main__': print ip2long1("173.230.156.208") print ip2long2("173.230.156.208")
———–
post by gmail~
原文:http://www.javaeye.com/topic/600079
各种语言,各种算法,下面总结成python
#!/usr/bin/env python def bl1(nums): for i in xrange(1,len(nums) - 1): if sum(nums[:i]) == sum(nums[i+1:]): return i, nums[i] return None def bl2(nums): total = sum(nums) left = 0 for i in xrange(1,len(nums) - 1): left += nums[i-1] if (left == total - left - nums[i]): return i, nums[i] return None def bl3(nums): head_sum = 0 end_sum = 0 head = 0 end = len(nums) - 1 add_head = True add_end = True while head < end: if add_head: head_sum += nums[head] if add_end: end_sum += nums[end] if head_sum < end_sum: head += 1 add_head = True add_end = False elif head_sum > end_sum: end -= 1 add_head = False add_end = True else: head += 1 end -= 1 add_head = True add_end = True if head_sum == end_sum: return head, nums[head] else: return None test = [1,3,5,7,8,25,4,20] print bl1(test) print bl2(test) print bl3(test)
———–
post by gmail~
再次对centos的python版本表示无语
wget http://www.python.org/ftp/python/2.6.6/Python-2.6.6.tar.bz2 tar jxvf Python-2.6.6.tar.bz2 cd Python-2.6.6 ./configure --prefix=/opt/python26 make make install cd .. #试过10.2.0版本,不能用。。。 wget http://tmrc.mit.edu/mirror/twisted/Twisted/10.1/Twisted-10.1.0.tar.bz2 tar jxvf Twisted-10.1.0.tar.bz2 cd Twisted-10.1.0 /opt/python26/bin/python setup.py install cd .. wget http://www.zope.org/Products/ZopeInterface/3.3.0/zope.interface-3.3.0.tar.gz tar zxvf zope.interface-3.3.0.tar.gz cd zope.interface-3.3.0 /opt/python26/bin/python setup.py install cd .. wget http://proxy65.googlecode.com/files/Proxy65-1.2.0.tar.gz tar zxvf Proxy65-1.2.0.tar.gz cd Proxy65-1.2.0 /opt/python26/bin/python setup.py install #OK /opt/python26/bin/python /opt/python26/bin/twistd proxy65 --jid=proxy.xxx.com --secret=secret --rhost=127.0.0.1 --rport=5347 --proxyips=127.0.0.1:7777
———–
post by gmail~
proxy65安装时报错:
exceptions.ImportError: No module named words.protocols.jabber
文档里只说python setup.py install就OK了
解决:
sudo apt-get install python-twisted
———–
post by gmail~