parsed.org

Tips by tag: set

Mount Drive with Authentication by xinu on Jul 12, 2008 12:26 PM

I'm still hammering this out, but it works as-is:

@echo off
rem Simple script to map a drive using the new IP provided.
echo Enter final octet:
set /p OCTET=

net use z: \\10.0.100.%OCTET%\c$ /user:inside\<username> <password>

I'd like the octet entry and the echo to be on the same line, but aside from that, working as advertised.

authenticationbatbatchdosdriveechomountnetremset
Remove Duplicates by xinu on Jan 13, 2005 08:50 AM

Remove duplicate elements from a list:

newList = dict([(item, 1) for item in oldList]).keys()

Or, if you have Python 2.3 or newer, you can use a Set object to collapse your list:

import sets
newList = list(sets.Set(oldList))
dataimportlanguagesprogrammingpythonsetsyntax
RSS