I am currently troubleshooting a utility that I have been working on. The main file of the utility is below. Please not that `flatten_dict` and `makerows` are seperate files and functions, respectively. My objectives are to: * Recursively traverse a directory - done * Find XML and text files only - any thoughts on how to build this into the function below would be very helpful * Print these files out to the console - done * Apply `flatten_dict` to take each of the txt or XML files and 1) parse it into a string of key value pairs (done) …
|+0 forum 21|
Lenovo Y480, Win 8.1. Last month a Malware Bytes update started cannibalizing my system, quarantining over 600 driver files, .dlls and assorted stuff. (Earlier part of that story [here](http://www.daniweb.com/hardware-and-software/microsoft-windows/viruses-spyware-and-other-nasties/threads/481460/mbam-blocked-and-cant-scan-cant-upate-cant-install-it-again#). I tried to undo everything, and in the process uninstalled MBAM, thereby deleting the quarantined files. My system is full of holes, and won't do odd things, like recognise external USB hard drives or thumb drives. There are no system restore points prior to the problem. This is a problem for me, because my laptop came without a system restore disc. I took the precaution of making a system restore image …
|+0 forum 4|
I have written some code just to practice verbosity in python. Verbosity is embedded by means of the ArgumentParser module....however, I'd also like to write the stdout to file also when verbosity is disabled : #!/usr/bin/python from optparse import OptionParser from argparse import ArgumentParser import sys def printable1(): print "1" def printable2(): print "2" def printable3(): print "3" def Main1(): printable1() printable2() def Main2(): printable2() printable3() class Logger(object): def __init__(self): self.terminal = sys.stdout self.log = open("logfile2.log", "a") def write(self, message): self.terminal.write(message) self.log.write(message) #te = open('./logfiles.txt','w') # File where you need to keep the logs #class Unbuffered: #def __init__(self, stream): #self.stream …
|+0 forum 0|
Shows you how to get a Python object's memory size. Notice that there can be a difference between Python versions.
|+3 forum 3|
if i try to dump from shell like this `python -c 'help("modules")' > ~/Desktop/modules.txt` but if I try to execute from within the python like this `>>os.system("python -c 'help("modules")' > ~/Desktop/modules.txt")` i get error File "<stdin>", line 1 os.system("python -c 'help("modules")' > ~/Desktop/modules.txt") ^ SyntaxError: invalid syntax once i get to save data to disk I want to populate module names to a list by reading the modules.txt, but it is contained in a way it is a list i pull but combination of strings too..
|+0 forum 2|
So I have a code that prints out the `sys.argv` when the program is ran. How can I parse $ python ./arch.py install * to show `["./arch.py","install","*"]` Instead of `["./arch.py","install",#other files in directory]`?
|+0 forum 1|