首页 \ 问答 \ python使用包含模式复制文件(python copying the files with include pattern)

python使用包含模式复制文件(python copying the files with include pattern)

我需要使用python脚本复制包含模式的文件。 由于shutil支持ignore_patterns忽略该文件。 是否有任何方法可以包含模式来复制文件。 否则我是否必须明确编写代码?

提前致谢

编辑

from shutil import copytree, ignore_patterns

source=r'SOURCE_PATH'
destination=r'DESTINATION_PATH'
copytree(source, destination, ignore=ignore_patterns('*.txt'))

上面的代码复制了dir文件,除了指定的格式,但是我需要这样的东西

from shutil import copytree, include_patterns

source=r'SOURCE_PATH'
destination=r'DESTINATION_PATH'
copytree(source, destination, ignore=include_patterns('*.txt'))

I need to copy the files with include pattern using python script. Since shutil supports ignore_patterns to ignore the file. Is there any method to include the pattern to copy the files. Otherwise do I have to write the code explicitly?.

Thanks in advance

EDIT

from shutil import copytree, ignore_patterns

source=r'SOURCE_PATH'
destination=r'DESTINATION_PATH'
copytree(source, destination, ignore=ignore_patterns('*.txt'))

The above code copied the files from dir except specified format, But I need something like this below

from shutil import copytree, include_patterns

source=r'SOURCE_PATH'
destination=r'DESTINATION_PATH'
copytree(source, destination, ignore=include_patterns('*.txt'))

原文:https://stackoverflow.com/questions/52071642
更新时间:2023-05-11 07:05

最满意答案

我已经解决了 问题出在我的glTranslatef上。 我在渲染到FBO时完成了glPushMatrix()并设置了所需的矩阵参数,现在一切正常。


I have solved it. The problem was with my glTranslatef. I done glPushMatrix() and setted needed matrix parameters when rendering to FBO, and everything works fine now.

相关问答

更多
  • 我终于设法解决了这个问题。 我其实忘了用这个命令设置视口: glViewport(0, 0, WIDTH, HEIGHT); 现在,一切都看起来不错,我的着色器被正确使用。 此代码示例已被简化为其最基本的形式,实际上是跨平台离屏渲染项目的一部分。 事情是,在OSMesa库的帮助下,我已经使它在Linux上工作了。 这意味着OSMesa不需要视口初始化来执行与CoreGL相反的正确渲染。 很高兴知道! I finally managed to fix the problem. I actually forg ...
  • macOS上的最大PID为99998。 与Linux不同,此值不可调。 我不知道有什么方法可以在程序中检索它; 您应该做的唯一假设是进程ID的值将适合pid_t类型。 The maximum PID on macOS is 99998. Unlike on Linux, this value is not tunable. I'm not aware of any way to retrieve it in a program; the only assumption you should make is ...
  • 您是否安装了Apple开发工具? 如果你输入gcc -v会怎么样? 看起来你没有下载开发的东西。 您可以从http://developer.apple.com/免费获得(注册后) Have you installed the Apple developer tools? What happens if you type gcc -v ? It look as if you do not have downloaded the development stuff. You can get it for fre ...
  • 看起来你需要重写NSSliderCell的- (void)drawKnob:(NSRect)knobRect和- (void)drawBarInside:(NSRect)aRect flipped:(BOOL)flipped 。 来自NSSliderCell类的引用 Looks like you need to override NSSliderCell's - (void)drawKnob:(NSRect)knobRect and - (void)drawBarInside:(NSRect)aRect f ...
  • 我注意到他们在Silverlight下载页面上列出了Mac的Silverlight 5 beta开发人员运行时 ,所以我想说,是的,它仍然支持。 I noticed they have a Silverlight 5 beta developer runtime for Mac listed on the Silverlight download page, so I would say, yes its still supported.
  • 似乎我并没有完全遵循dlang网站上的建议。 经过一段时间的调试,我发现了解决方案: dmd.conf文件不正确,因此找不到libphobos2.a。 现在我的dmd.conf文件看起来像: [Environment] DFLAGS=-I%@P%/../src/phobos -I%@P%/../src/druntime/import -L-L%@P%/../osx/lib It seems that I did not precisely followed the advices on the dlan ...
  • 在GNOME wiki上找到了这些说明: GTK + / OSX / Building和GTK + / OSX / Python Found these instructions on the GNOME wiki: GTK+/OSX/Building and GTK+/OSX/Python
  • which使用它继承的PATH的值。 没有返回任何内容的事实确认您需要将适当的目录添加到PATH 。 which uses the value of PATH that it inherits. The fact that which returns nothing confirms that you need to add the appropriate directory to your PATH.
  • OS X 10.8是在NDA下,我们不能自由提供有关它的详细信息,但我可以告诉你,在10.7或任何其他最近的OSX版本下没有/ Library / Preferences / loginwindow,你应该这样做: defaults write \ ~/Library/Preferences/loginwindow \ AutoLaunchedApplicationDictionary \ -array-add '{ "Path" = "/path/to/script"; "Hide ...
  • 我已经解决了 问题出在我的glTranslatef上。 我在渲染到FBO时完成了glPushMatrix()并设置了所需的矩阵参数,现在一切正常。 I have solved it. The problem was with my glTranslatef. I done glPushMatrix() and setted needed matrix parameters when rendering to FBO, and everything works fine now.

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。