码迷,mamicode.com
首页 >  
搜索关键字:coding    ( 12955个结果
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:55:48    阅读次数:162
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:55:03    阅读次数:158
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:30    阅读次数:166
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:54:16    阅读次数:239
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:53:23    阅读次数:238
Python 2.7.9 - 005.字符串判空
#coding=utf-8#!/usr/bin/pythonstr1 = None;str2 = '';str3 = ' ';if str1 == None : print("str1 is none.");else : print("str1 is not none.");if str...
分类:编程语言   时间:2015-07-02 22:33:29    阅读次数:163
Python 2.7.9 - 014.列表List的定义、取值、遍历
#coding=utf-8#!/usr/bin/pythonlist = ['a', 1, 'b', 2, 'c', 3];print list[0];print list[1:3];print list * 2;print list + list + list;# 遍历print('for eac...
分类:编程语言   时间:2015-07-02 22:23:05    阅读次数:553
Python 2.7.9 Demo - 001.print_hello_world - 002.print_chinese
001.print_hello_world#!/usr/bin/pythonprint "hello, world...";002.print_chinese#coding=gbk#!/usr/bin/pythonprint "你好吗"
分类:编程语言   时间:2015-07-02 22:18:40    阅读次数:108
python coding style / python编程风格
#from 《Python 2.7.9 documentation》Use 4-space indentation, and no tabs.#使用4空格缩进,不要使用tab缩进Wrap lines so that they don’t exceed 79 characters.拆行确保每行不超过7...
分类:编程语言   时间:2015-07-02 22:16:39    阅读次数:154
Python读写csv文件
1. 写入并生成csv文件代码:# coding: utf-8import csvcsvfile = file('csv_test.csv', 'wb')writer = csv.writer(csvfile)writer.writerow(['姓名', '年龄', '电话'])data = [ (...
分类:编程语言   时间:2015-07-02 17:02:24    阅读次数:135
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!