首页 > 编程语言
python学习日常-编码与字符串格式化
python编码也是遵循计算机技术的编码的,英文编码还是遵循ascii码,中文编码遵循gb2312,都遵循的是utf-8编码。值得注意的是几个函数,ord("a"),是查询a的utf-8编码。chr("778"),是通过utf-8编码查询对应的字符,len("str")是查询字符串占多少位字节的相当...
分类:编程语言   时间:2015-07-03 00:05:43    收藏:0  评论:0  赞:0  阅读:397
[LeetCode][JavaScript]Kth Smallest Element in a BST
Kth Smallest Element in a BSTGiven a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is alw...
分类:编程语言   时间:2015-07-03 00:05:23    收藏:0  评论:0  赞:0  阅读:293
Python 2.7.9 Demo - 020.函数的定义、返回
#coding=utf-8#!/usr/bin/pythondef setConfig(): hello = 'world'; print 'The value has been setted.'; return hello; hello_cp = setConfig();p...
分类:编程语言   时间:2015-07-03 00:04:23    收藏:0  评论:0  赞:0  阅读:246
Java修饰符
Java语言提供了很多修饰符,主要分为以下两类:访问修饰符非访问修饰符修饰符用来定义类、方法或者变量,通常放在语句的最前端。我们通过下面的例子来说明:public class className { // ...}private boolean myFlag;static final doubl.....
分类:编程语言   时间:2015-07-03 00:01:03    收藏:0  评论:0  赞:0  阅读:328
2015第27周三Java内存模型
自己写的代码,6个月不看也是别人的代码,自己学的知识也同样如此,学完的知识如果不使用或者不常常回顾,那么还不是自己的知识。要认识java线程安全,必须了解两个主要的点:java的内存模型,java的线程同步机制。特别是内存模型,java的线程同步机制很大程度上都是基于内存模型而设定的。浅谈java内...
分类:编程语言   时间:2015-07-03 00:00:33    收藏:0  评论:0  赞:0  阅读:246
Python 2.7.9 Demo - isinstance
#coding=utf-8#!/usr/bin/pythona = 'abc';print isinstance(a, str);
分类:编程语言   时间:2015-07-03 00:00:23    收藏:0  评论:0  赞:0  阅读:256
Test语言编译器V1.0
感觉这个挺好耍的,书上的代码有错误,而且功能有限。一、词法分析特点:(1)可对中文进行识别:(2)暂不支持负数,可以在读入‘-'时进行简单标记后就能对简单负数进行识别了。#include #include #include #include using namespace std;#define K...
分类:编程语言   时间:2015-07-02 23:59:23    收藏:0  评论:0  赞:0  阅读:551
通过指针访问C++对象的私有成员
C/C++, 对象, 访问私有成员
分类:编程语言   时间:2015-07-02 23:57:03    收藏:0  评论:0  赞:0  阅读:511
SWIFT推送之本地推送(UILocalNotification)
本地推送通知是通过实例化UILocalNotification实现的。要实现本地化推送可以在AppDelegate.swift中添加代码实现,本事例是一个当App进入后台时推送一条消息给用户。1.首先在didFinishLaunchingWithOptions方法内添加代码,IOS8推送消息首先要获...
分类:编程语言   时间:2015-07-02 23:56:13    收藏:0  评论:0  赞:0  阅读:311
Python 2.7.9 Demo - 三元表达式
#coding=utf-8#!/usr/bin/pythonimport logging;a = 'abc';print 'Y' if isinstance(a, str) else 'N';
分类:编程语言   时间:2015-07-02 23:54:22    收藏:0  评论:0  赞:0  阅读:378
Python 2.7.9 Demo - 获取调用的参数
#coding=utf-8#!/usr/bin/pythonimport sys;print("The command line parameters are : ");for i in range(0, len(sys.argv)) : print str(i) + ' -> ' +...
分类:编程语言   时间:2015-07-02 23:54:03    收藏:0  评论:0  赞:0  阅读:317
Javascript为元素添加事件处理函数
document.getElementById("test").onclick = function(){ ...};
分类:编程语言   时间:2015-07-02 23:53:53    收藏:0  评论:0  赞:0  阅读:226
java时间处理工具类--DateUtils
package com.hexiang.utils;/** * @(#)DateUtil.java * * * @author kidd * @version 1.00 2007/8/8 */import java.util.*;import java.text.*;import java.sql....
分类:编程语言   时间:2015-07-02 23:53:13    收藏:0  评论:0  赞:0  阅读:402
Python 2.7.9 Demo - 015.元组的定义、取值、遍历
#coding=utf-8#!/usr/bin/pythonfinal_list = ('a', 1, 'b', 2, 'c', 3);print final_list[0];print final_list[1:3];print final_list * 2;print final_list + ...
分类:编程语言   时间:2015-07-02 23:52:43    收藏:0  评论:0  赞:0  阅读:291
JavaScript 用new创建对象的过程
在JavaScript中创建自定义对象都需要用new运算符,那么创建对象的过程是什么样的呢?例如现在有如下构造函数:function Person(name) { this.name = name;}Person.prototype = { constructor: Person, ...
分类:编程语言   时间:2015-07-02 23:52:13    收藏:0  评论:0  赞:0  阅读:261
Python 2.7.9 Demo - JSON的编码、解码
#coding=utf-8#!/usr/bin/pythonimport json;dict = {};dict['name'] = 'nick';dict['say'] = 'hello world...';dict['age'] = '20';dict_json = repr(dict);pri...
分类:编程语言   时间:2015-07-02 23:51:53    收藏:0  评论:0  赞:0  阅读:355
Python 2.7.9 Demo - ini文件的读、写
ini文件[weixin_info]hello = Nick Huang#coding=utf-8#!/usr/bin/pythonimport ConfigParser;cp = ConfigParser.ConfigParser();cp.read('027.99.config.ini');he...
分类:编程语言   时间:2015-07-02 23:51:02    收藏:0  评论:0  赞:0  阅读:286
javascript 函数(2)
一、什么是函数 函数的作用,可以写一次代码,然后反复地重用这个代码。 比如:我们要完成多组数和的功能。 var?sum; sum?=?3+2; alert(sum); sum=7+8; alert(sum); .......?????//不停地重复这两行代码...
分类:编程语言   时间:2015-07-02 22:46:43    收藏:0  评论:0  赞:0  阅读:243
LeetCode219 ContainsDuplicateII java题解
题目: Given an array of integers and an integer k, find out whether there there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is a...
分类:编程语言   时间:2015-07-02 22:44:23    收藏:0  评论:0  赞:0  阅读:412
算法练习:两指针之有序数组去重
问题描述 给出一个有序数组,就地移除重复元素,保持每个元素只出现一次,并返回新数组的长度。   问题分析 这个比较简单,直接使用两个指针,一个在前,一个在后,扫描一遍数组即可。时间复杂度为O(n^2)。 比如数组A = { 1,1, 2, 3, 3 },看下图,思想简单明了。       代码实现 #include using namespace std; //去除数组...
分类:编程语言   时间:2015-07-02 22:44:03    收藏:0  评论:0  赞:0  阅读:383
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!