0

I want to combine 200+ python files and append them into one file. This can be easily achieved with text files but these are python files. I've read to just "egg" it or "zip" it. But I can't seem to find anywhere examples on how to go about this, at least for windows. Zipping it would mean that the files would just be located elsewhere.

I believe there is a github project, though this is not supported for python 3.

Any ideas on how this can be achieved on Windows. I've found almost all the solutions are in some way referencing an 'exe' whereas I don't want this in windows. I just want the code in the files put together so I don't have to open 250 python files.

This is in reference to py files. Which are treated differently than text files. � ����LL��A� H��H��臠 H��t H��tL��H�� H�

You could in theory copy the python script to a csv but I tend to get this lovely output above.

  • if you combine all the files, how will you be able to import the files by name? – Jean-François Fabre Nov 20 '17 at 21:05
  • I'm almost positive you can just open them like .txt files. – SuperStew Nov 20 '17 at 21:06
  • @SuperStew They have a different extension though. Python not likee. –  Nov 20 '17 at 21:07
  • @Jean-FrançoisFabre *sigh*, thats for text files. I've tried that –  Nov 20 '17 at 21:09
  • @TysonDogerzonda I didn't close your question. Coldspeed did. But I don't see the difference between python files & text files. And what's the use? – Jean-François Fabre Nov 20 '17 at 21:12
  • @Jean-FrançoisFabre Well lets say I did take that example as fact : import glob read_files = glob.glob("*.py") with open("C:/Users/dda/craigslist_sample/E.py", "wb") as outfile: for f in read_files: with open(f, "rb") as infile: outfile.write(infile.read()) Produces: H���ڌ ��tB��qn ��H�H��H;FsH� . Not exactly readable or appended. –  Nov 20 '17 at 21:20
  • no, .py files are text files. maybe you're reading `.pyc` files. – Jean-François Fabre Nov 20 '17 at 21:49

0 Answers0