码迷,mamicode.com
首页 >  
搜索关键字:python    ( 135041个结果
python中读取某个路径文件夹下所有文件--listdir()
描述: 当需要读取某个文件下的所有文件时,可以使用listdir()函数,使用该函数之前,需导入模块:from os import listdir 语法: listdir('file path/file name') 参数: file path:文件夹路径,可以是相对路径或绝对路径 file nam ...
分类:编程语言   时间:2017-07-01 10:53:43    阅读次数:446
python解释NTFS runlist的代码
代码如下:#!/usr/bin/python3 #http://www.frombyte.com张宇 importos importsys importrandom importhashlib importstruct importzlib importre defhelp_exit(): print("命令格式:") print("python3%s<Filename><Startbytes><StartLCN><StartVCN>:"..
分类:编程语言   时间:2017-07-01 10:04:20    阅读次数:239
python+selenium启动firefox和chrome
有段时间没整自动测试了,今天准备接着在搞搞,打开pycharm已运行脚本,发现firefox打开了不会进行任何操作,chrome也打开了,也是不进行任何操作,瞬间就蒙蔽了,之前不是好好的么,怎么突然就.........,那就开整吧看了下firefox的版本,51.xx,好吧,firefox老是喜欢偷偷的升级,那就卸载..
分类:编程语言   时间:2017-07-01 10:04:13    阅读次数:190
Python基础课:一起学习python基础题
python最近老火了,万能开发语言,很多小伙伴们要么初学,要么从别的开发语言转过来的,如果你能把下面几道基础题不费劲的写出来,基础应该可以打80分,可以进行进阶的学习了,如果下面的题目如果做不出来,拜托不要耽误时间,赶快打好基础,勿在浮沙筑高台。 题目出给新鸟打基础的,实现答案的方法千千万,如果老 ...
分类:编程语言   时间:2017-07-01 10:03:47    阅读次数:184
Python基础课:定义一个函数,可以对序列逆序的输出(对于列表和元组可以不用考虑嵌套的情况)
1 15 def fun(arg): 2 16 if type(arg) is not tuple \ 3 17 and type(arg) is not str \ 4 18 and type(arg) is not list: 5 19 print('请输入一个序列') 6 20 return ... ...
分类:编程语言   时间:2017-07-01 10:03:10    阅读次数:256
Python基础课:列表常用的方法
lst.append(x) | 将元素x添加至列表lst尾部 lst.extend(L) | 将列表L中所有元素添加至列表lst尾部 lst.insert(index, x) | 在列表lst制定位置index处添加元素x,该位置后面的所有元素后移一个位置 lst.remove(x) | 在列表ls ...
分类:编程语言   时间:2017-07-01 10:02:20    阅读次数:146
ValueError: Attempt to reuse RNNCell <tensorflow.contrib.rnn.python.ops.core_rnn_cell_impl.BasicLSTMCell object at 0x7f1a3c448390> with a different variable scope than its first use.解决方法
最近在做生成电视剧本小项目,遇到以下报错 在此先给出解决方法,后续整理一下,写上原因 初始有报错代码: 改进后的代码: 可参考: ValueError: Attempt to reuse RNNCell with a different variable scope than its first u ...
分类:编程语言   时间:2017-07-01 10:01:37    阅读次数:1224
Python狂练-1
有四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少?把数字变成字符再把字符拼起来: #!/usr/bin/env python # -*- coding:utf-8 -*- x = 0 for i in range(1,5): for j in range(1,5): f ...
分类:编程语言   时间:2017-07-01 10:00:13    阅读次数:202
Python基础课:多继承
class Base: def play(self): print('这是Base') class A(Base): def play(self): print('这是A') class B(Base): def play(self): print('这是B') class C(A,B): def ... ...
分类:编程语言   时间:2017-07-01 09:59:18    阅读次数:209
Python基础课:九九乘法表
1 for i in range(1,10): 2 for j in range(1,10): 3 if i == j: 4 print('{}*{}={}'.format(j,i,i*j)) 5 elif j < i: 6 print('{}*{}={}'.format(j,i,i*j), end... ...
分类:编程语言   时间:2017-07-01 09:57:43    阅读次数:393
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!