Skip to content

Tag: file

python string not writing to a file

this function is being called by the way the file is correct ‘paragraphs.txt’ but when it runs it finishes with no errors but doesn’t write anything to the file git files file with problem: https://github.com/K-972/english_helper write to file test: https://github.com/K-972/file-write-test i…

Remove text lines and strip lines with condition in python

I have a text file in this format: I want to remove the lines that don’t have a [number1,number2,number3,number4,1] or [number1,number2,number3,number4,5] ending and also strip the text line and remove the [blocks] -> [number1,number2,number3,number4,number5] that don’t fulfill this condition. …

valid and corrupt lines from file

As you can read, the function validate_data should check the imported file for corrupt and valid lines, then append them to the correct list, and print them. It works, except that, as you can probably see, the lines will not print in a single line. I’m sure I have to make two other lists to append the c…

Manipulating files using Python

My old friend and I have been trying to save our chat histories recently for the nostalgia and the memories. Google chat history saves in a latest-oldest order. I’d like to make it to oldest-latest as well as change the pattern of the text. Any idea how I can implement this in Python? For reference this…

Variable file name breaks excel sheet creation

I’ve a code which creates an excel in a specific field with 3 sheets: I need the file name to become a varaible and I’ve done this: Even though the file_name is variable now, I get an error with the sheets creation and It’s blowing my mind. Any other way to make it variable? Thanks Answer Us…