Goal:

I want to write a program for this:
In a folder I have =n= number of files;
first read one file and perform some operation then store result in a separate file.
Then read 2nd file, perform operation again and save result in new 2nd file.
Do the same procedure for n number of files.
The program reads all files one by one and
stores results of each file separately.

solution:

#+BEGIN_SRC Python
import sys
#argv is your commandline arguments, argv[0] is your program name, so skip it

for n in sys.argv[1:]:
print(n) #print out the filename we are currently processing
input=open(n,"r")
output=open(n,+".out","w")
# do some processing
input.close()
output.close()
#+END_SRC

- syn :: system-specific parameters and functions
- module :: a file contains Python code

why python module?

Python module is used to group related functions, classes, and variables
for better code management and avoiding name clash

https://stackoverflow.com/questions/208120/how-to-read-and-write-multiple-files

最新文章

  1. swift 学习笔记
  2. mysqll底层分享(一):MySQL索引背后的数据结构及算法原理
  3. ecshop 配送方式支持"货到付款"
  4. HTML 5 Canvas 参考手册
  5. LINQ找出重复和不重复的元素及linq OrderBy 方法 两个字段同时排序有关问题
  6. shell脚本例子集锦(习题总结)
  7. transform的使用
  8. zoj 3761
  9. IE兼容问题
  10. [android]android开发中的运行错误之:adb.exe
  11. Android系统Root原理初探(转)
  12. html5学习(一) video字段
  13. PowerShell 异常处理
  14. Photoshop给人像加上个性裂纹肌肤
  15. JavaScript(JS)之Javascript对象BOM,History,Location,Function...(二)
  16. python语法_算数运算+赋值运算符+比较运算符+逻辑运算符
  17. linux 修改centos7的网卡ens33修改为eth0
  18. hadoop-2.7.3完全分布式部署
  19. vue tab切换
  20. [日常] HEOI 2019 退役记

热门文章

  1. 10.05FZSZ Day2模拟总结
  2. [CF348B]Apple Tree
  3. nodejs常用命令
  4. LVS集群体系和调度算法
  5. 使用 script 的 module 属性实现 es6 以上的兼容
  6. native2ascii命令详解
  7. git Eclipse项目不显示当前分支
  8. django.db.utils.OperationalError: (1050, "Table '表名' already exists)解决方法
  9. Android 知识Tips
  10. viewpager滑动时页面不能刷新