Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
2 answers
190 views

Checking file header for magic number in Python

I wrote this to check files for successful compression with LZ4. Any advice is welcome. Particularly regarding raising exceptions and error handling. ...
voices's user avatar
  • 767
3 votes
1 answer
78 views

Python Function that Replicates a Directory's File-Tree for Specific File Types while Changing the Parent Directory

Problem Context: I needed to make a script that would search through all the files in a GitHub Repo and find all the README files within it, then replicate the File-Tree of the Repo to a specified ...
Prithvi Boinpally's user avatar
1 vote
1 answer
876 views

Adding string to a text file without duplicates

I have a function below, store_in_matchid_file, and it adds certain strings to a .txt file as long as that string doesn't already exist in the file. However that ...
Jack's user avatar
  • 47
2 votes
1 answer
1k views

Hashing with python optimization, hashlib and multiprocessing

I am looking to get any type of improvement, I want to be able to hash a list of 'blocks' aka strings and check if hashes match per block, if you can help me with that, currently reading and writing ...
R0Best's user avatar
  • 75
2 votes
2 answers
86 views

Send an array of files and return the first one that exists

I have a little project, chuy, which is basically a copy of Make. By request of users I have added support for toml configuration, since originally it only accepted ...
Eliaz Bobadilla's user avatar
4 votes
2 answers
3k views

Breaking a 3GB gz file into chunks

I have a 3GB gz file that I am trying to break into chunks of smaller files which are not required to be gz (I tried to make files of 10000000 lines, this is not a requirement, the chunks could be of ...
Ahlam AIS's user avatar
3 votes
1 answer
77 views

Simple file-renaming program in python

I’m learning python and have built a very simple program that just renames files. It makes all letters lowercase and replaces spaces and %20-instances with ...
user8758206's user avatar
3 votes
1 answer
798 views

Python - A Regex Text File Searcher by Content Project

I would like some advice on efficiency and ways to further remove redundant code. Regex Text File Search: enter a valid directory path, and a string to search for makes a list containing all the ...
Anonymous's user avatar
  • 1,244
6 votes
3 answers
613 views

Check header files for namespace usage

To ensure there are no naming conflicts within our project (C++) I was tasked with writing a python script to check all of our header files for any occurrences of a ...
Ben A's user avatar
  • 10.7k
3 votes
1 answer
85 views

Python file modifying script with focus on OOP

I am currently coding a tool for my work that modifies a textfile by removing unneeded parts of a string at specific spots in the file. I would like to know if there are any obvious things I am ...
FrozenAra's user avatar
  • 133
4 votes
1 answer
172 views

Check existence of user identification number

I was tasked with writing a python script to check if a passed ID number exists within a file. The file I was give contains roughly 25,000 unique ID numbers. An ID number is a unique 9 digit number. ...
Ben A's user avatar
  • 10.7k
8 votes
2 answers
169 views

File classifier based on extension and date modified

Note: this code will be run using portable WinPython 3.7.6.0 (Python 3.7.6, package list here) on Win10x64. Installing new packages or upgrading the Python version are not an option for this project. ...
Mast's user avatar
  • 13.8k
2 votes
1 answer
121 views

Python Etiquette for Functions in Multiple Files

Here's the context: My code is meant to automate testing of OCR (Image to Text programs) for a science project which could easily be read and understood my others. The code includes sets of functions ...
Theo's user avatar
  • 193
2 votes
2 answers
62 views

Speed performance of picking unique value from binary matrix file

I wrote this code to read a square matrix saved as binary file, that it can be int, uint, float etc... to pick a value from the matrix at given row ...
Khaled's user avatar
  • 349
4 votes
1 answer
84 views

Python timing optimisation

I'm new in this community and with Python 3! I'm trying to optimize this exercise: We have n strings stored in a txt file. Inside the strings a secret word is ...
Lorenzo Arcioni's user avatar

15 30 50 per page
1
2 3 4 5