[Tutor] Substitution function needed

Alan Gauld alan.gauld at btinternet.com
Fri Jan 15 19:32:40 EST 2016


On 15/01/16 17:07, Chad Perry wrote:
> #The function for writing random data to the disk.
> def random():
>    os.system("/sbin/fdisk -l")

>    device=raw_input("Enter device: ")
>    count=input("How many times would you like to wipe the device? ")
>    raw_input("Press Enter to continue, or Ctrl+C to exit: ")
>    lap=1
>    for i in range(count):
>        print "Processing wipe count %s of %s..."%(lap, count)
>        os.system(("dd if=/dev/urandom of=%s")%(device))
>        lap=lap+1
> 
> I need to know how to substitute for the drive letter for the following drives.
> 
> sad-sdp
> also will need to wipe data from /dev/md1

Sorry, it's not clear to me exactly what you want to substitute.
Can you provide sample input and output?
For example, if I input
/dev/sda
What do you want to happen?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list