上一页 1 ··· 4 5 6 7 8 9 下一页
摘要: import os path = 'F:\Python\open project\SGI\SGI_STL' paths = path.replace('\\', '//') paths = paths + '//' print paths files = os.listdir(paths) for i in files: #print(i) pat = None pa... 阅读全文
posted @ 2018-10-16 12:56 子觉 阅读(1589) 评论(0) 推荐(0) 编辑
摘要: ''' 为了避免截断中文字符 文件要求是 unicode 编码 txt文件另存为对话框下面有下拉框,可选存 储编码格式 ''' import os import struct #导入所需python模块方法 filename = str(raw_input("Please enter an old file name: ")) filenamepre = str(r... 阅读全文
posted @ 2018-10-16 12:51 子觉 阅读(1989) 评论(0) 推荐(0) 编辑
摘要: 运行这段python登陆163获取邮件和通讯录列表方法的代码后,会在当前目录下生成三个文件: (1)inboxlistfile.txt记录收件箱邮件列表;(2)addfile.txt记录通讯录;(3)cookies.dat记录cookies; #-*- coding:UTF-8 -*- import 阅读全文
posted @ 2018-10-16 12:47 子觉 阅读(1283) 评论(0) 推荐(0) 编辑
摘要: 描述 Python strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。 注意:该方法只能删除开头或是结尾的字符,不能删除中间部分的字符。 Example: #!/usr/bin/python # -*- coding: UTF-8 -*- str = "0000000 阅读全文
posted @ 2018-10-16 12:03 子觉 阅读(205) 评论(0) 推荐(0) 编辑
摘要: import random; guess_list = ['石头', '剪刀', '布']; rules = [['石头', '剪刀'], ['剪刀', '布'], ['布', '石头']]; computer = random.choice(guess_list); print(computer); people = input("石头, 剪刀, 布:\n").strip(); ... 阅读全文
posted @ 2018-10-16 11:56 子觉 阅读(1238) 评论(0) 推荐(0) 编辑
摘要: 购物车小程序 需求描述如下: 1.提示用户输入薪水 2.用户输入薪水后,打印商品编号、内容及价格 3.提醒用户输入商品代码,若余额大于等于商品价格,可购买;若小于,提示用户余额不足 4.用户输入q ,退出交易,打印用户购买的商品和余额 #-*-coding:utf-8 -*- goods_list= 阅读全文
posted @ 2018-10-16 11:38 子觉 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 下面由三个长度为 4 的列表组成的 3x4 矩阵: >>> matrix = [ ... [1, 2, 3, 4], ... [5, 6, 7, 8], ... [9, 10, 11, 12], ... ] 下面的列表推导式将转置行和列: >>> [[row[i] for row in matrix 阅读全文
posted @ 2018-10-15 17:36 子觉 阅读(757) 评论(0) 推荐(0) 编辑
摘要: Directory: 1.List, tuple action 2.String operations 3.Dictionary operations 4.Set 5.File operations 6.Character encoding and transcoding 1.List and Tu 阅读全文
posted @ 2018-10-15 15:52 子觉 阅读(360) 评论(0) 推荐(0) 编辑
摘要: #coding=utf-8 import PIL import qrcode ####程序#### linkadd ='http://www.cmbc.com.cn' #这行可以不写 linkadd = input("请输入要转换为二维码的文字或网址,以回车结束:\n") filepath= r'D:\my_qrcode.png' img =qrcode.make(linkadd) ... 阅读全文
posted @ 2018-10-09 17:26 子觉 阅读(676) 评论(0) 推荐(0) 编辑
摘要: print "==========字体==========" print "\033[31;1mHello world,how are you \033[0m" #红 print "\033[32;1mHello world,how are you \033[0m" #绿 print "\033[33;1mHello world,how are you \033[0m" #黄 print "\... 阅读全文
posted @ 2018-09-21 01:23 子觉 阅读(4831) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 下一页