View Full Version : Special String Manipulation (Python)

1337455 10534
November 9th, 2007, 02:59 AM
Python (in my opinion) has some pretty funky string manipulation, and I love it.
However, say:

a = raw_input("Xact FilePath: ")
os.system("shred #where 'a' would go# -f -u -v -x -z")

How do I get the filepath (the str 'a') to pop up in the os.system call??

November 9th, 2007, 03:03 AM
os.system("shred #where '%s' would go# -f -u -v -x -z" % a)

For multiple values, it takes tuples after %.

1337455 10534
November 9th, 2007, 03:06 AM
but a is just one value...

#!/usr/bin/env python
import os, time
print "DETH SHRED"
a = raw_input("Xact FilePath: ")
os.system("sudo shred %s -f -u -v -x -z" % a)
b = input("Verify Deth? (Recursive Destruction of Directories as Well) [1:Y, 2:N]: ")
if b == 1:
os.system("sudo rm -r -f -d -v %s" % a)
elif b == 2:
print "Pwn3d."


1337455 10534
November 9th, 2007, 03:09 AM
Wow. I put that in, it works brilliantly!
Move on to the GUI!!
Is EasyGUI easy? - {Seems retarded, but, I need to know}

November 9th, 2007, 01:29 PM
Yes, EasyGUI is easy. It is not really a complete GUI toolkit, but it is an easy way to do things with a GUI. You can visit my wiki for links on learning and getting it.