type convert in python

摘要: there is no type cast in python, every conversion in python will create a new object. Not like in Java and C++, the original object will still be exist in the system.there are some of the built in functions in python to help the conversion. Such as:>>> int('123')123>>> int( 阅读全文
posted @ 2012-08-29 21:12 很遗憾我不是 阅读(322) 评论(0) 推荐(0) 编辑

mantra

摘要: The bible or the most important principle of some thing or some people.the mantra of the python language is that, it must keep the programming language simple. 阅读全文
posted @ 2012-08-29 19:55 很遗憾我不是 阅读(144) 评论(0) 推荐(0) 编辑

python none

摘要: The value "None" in python is equivalent to the values in other languages such as "void", "NULL". 阅读全文
posted @ 2012-08-29 19:50 很遗憾我不是 阅读(348) 评论(0) 推荐(0) 编辑

bool("")

摘要: >>> download_complete = False>>> bool(download_complete)False>>> bool(-1.23)True>>> bool(0.0)False>>> bool("")False>>> bool([None, 0])True>>> bool([0, 0])True>>> bool({0, 0, 0})True>>> bool 0SyntaxError: inval 阅读全文
posted @ 2012-08-29 17:25 很遗憾我不是 阅读(239) 评论(0) 推荐(0) 编辑

string formatting

摘要: print('Python and %s are number %d' % ('Django', foo)) 阅读全文
posted @ 2012-08-29 17:15 很遗憾我不是 阅读(197) 评论(0) 推荐(0) 编辑

Duck typing

摘要: This is referred to as “duck-typing”—if it waddles like a duck and quacks like a duck, then we can treat it as a duck.A very strong manner to determine the type of the variables of the python language. 阅读全文
posted @ 2012-08-29 17:14 很遗憾我不是 阅读(204) 评论(0) 推荐(0) 编辑

C# + HotKey

摘要: 注意:热键和快捷键是整合在一起的应用中,我们可能会需要实现像Ctrl+C复制、Ctrl+V粘贴这样的快捷键,本文简单介绍了它的实现,并给出了一个实现类。(1)建立一个类文件,命名为HotKey.cs,代码如下:using System;using System.Collections.Generic;using System.Runtime.InteropServices;using System.Windows.Forms;namespace KoalaStudio.BookshopManager{ class HotKey { //如果函数执行成功,返回值不为0。 //如果函数执... 阅读全文
posted @ 2012-08-29 13:47 很遗憾我不是 阅读(3917) 评论(2) 推荐(1) 编辑

stream reader and stream writer (file stream)

摘要: 在读写文件的过程中,Filestream只可以进行以字节为单位原始数据流进行读写操作,为此,C#中提供了功能更加强大的StreamReader/StreamWriter来支持文件的读写.StreamReader/StreamWriter可以进行以字符为单位的数据读写操作..一.用StreamReader的构造函数StreamReader有很多的构造函数:在这里只列出两个常用和比较常见的StreamReadersr=newStreamReader(Stream);Stream可以是Filestream;StreamReadersr=newStreamReader(String);String为指 阅读全文
posted @ 2012-08-17 14:33 很遗憾我不是 阅读(401) 评论(0) 推荐(1) 编辑

EXCEL 保存 DATATABLE

摘要: 废话不多说,贴代码:public static void Export2Excel(DataTable dtTemp, string fileName, bool append = false, Encoding encoding = null) { if (encoding == null) { encoding = Encoding.Default; } using (var writer = new StreamWriter(fileName, append, encoding)) { foreach (DataColumn dc in dtTemp.Columns) { writer. 阅读全文
posted @ 2012-08-17 10:32 很遗憾我不是 阅读(421) 评论(0) 推荐(0) 编辑

XML (C#)

摘要: 这是一个用c#控制台程序下, 用XmlDocument 进行XML操作的的例子,包含了查询、增加、修改、删除、保存的基本操作。较完整的描述了一个XML的整个操作流程。适合刚入门.net XML操作的朋友参考和学习。假设有XML文件:books.xml<?xml version="1.0" encoding="UTF-8"?><books> <book> <name>哈里波特</name> <price>10</price> <memo>这是一本很好看的书。&l 阅读全文
posted @ 2012-08-15 16:51 很遗憾我不是 阅读(394) 评论(0) 推荐(0) 编辑