自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(6)
  • 收藏
  • 关注

转载 Are there dictionary comprehensions in Python? (Problem with function returning dict)

I know about list comprehensions, what about dictionary comprehensions?Expected Output:>>> countChar('google') {'e': 1, 'g': 2, 'l': 1, 'o': 2} >>> countLetters('apple') {'a': 1, 'e'

2014-01-20 10:14:13 778

转载 python one-line list comprehension: if-else variants

It's more about python list comprehension syntax. I've got a list comprehension that produces list of odd numbers of a given range:[x for x in range(1, 10) if x % 2]This makes a filter - I've go

2014-01-20 10:09:06 3046

原创 在同一个位置更新进度

#include#include#includeint main(){ char *backSpaces = "\b\b"; printf( "00" ); for ( int process = 0 ; process < 100 ; process++) { printf("%s%02d",backSpaces,process);

2014-01-18 13:52:04 716

转载 python打印所有汉字

for ch in xrange(0x4e00, 0x9fa6): print unichr(ch)

2014-01-04 15:45:46 1307

转载 Difference between __str__ and __repr__ in Python

Unless you specifically act to ensure otherwise, most classes don't have helpful results for either:>>> class Sic(object): pass... >>> print str(Sic())__main__.Sic object at 0x8b7d0>>>> print re

2014-01-03 16:16:18 1387

原创 Raise and Handle Exception Demo

import sysclass MyError(Exception): def __init__(self,value): self.value = value def __str__(self): return repr(self.value)try: f = open('new.in') s = f.readline() f.close() i = int(s.st

2014-01-02 16:07:38 547

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除