Re: alphanumeric list
On Mar 15, 2:15 pm, yqyq22 wrote: > On Mar 15, 11:02 am, Laurent Claessens wrote: > > > > > > > Le 15/03/2011 09:10, yqyq22 a crit : > > > > Hi all, > > > I would like to put an alphanumeric string like this one > > > EE472A86441AF2E629DE360 in a list, then iterate inside the entire > > > string lenght and change each digit with a random digit. > > > Do u have some suggestion? thanks a lot > > > This can be a way to begin : > > > s="EE472A86441AF2E629DE360" > > for a in s: > > print a > > > The following is a very basic trick to build a list containing the > > elements of the string > > > s="EE472A86441AF2E629DE360" > > t=[] > > for a in s: > > t.append(a) > > > All that you have to change is t.append(a) into something that > > tests if a is a number and append something else in that case. > > > Depending what you want, you can even do > > > s.replace("1","ONE").replace("2","TWO").replace("3","FIVE") > > > This is however far from being random ;) > > > Have good tests > > Laurent > > Laurent thanks a lot very much!!! really appreciated it.. now i have a > good start point thanks again- Hide quoted text - > > - Show quoted text - Something like that but it append A to each element of the string string = "EE472B" t = [] for x in string[:]: print t.append("A") #i don't want to append A, the final result is EAEA4A7A2ABA # i would like to substitute each element with a random string How i can use the random module in this case? Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: alphanumeric list
On Mar 15, 11:02 am, Laurent Claessens wrote: > Le 15/03/2011 09:10, yqyq22 a crit : > > > Hi all, > > I would like to put an alphanumeric string like this one > > EE472A86441AF2E629DE360 in a list, then iterate inside the entire > > string lenght and change each digit with a random digit. > > Do u have some suggestion? thanks a lot > > This can be a way to begin : > > s="EE472A86441AF2E629DE360" > for a in s: > print a > > The following is a very basic trick to build a list containing the > elements of the string > > s="EE472A86441AF2E629DE360" > t=[] > for a in s: > t.append(a) > > All that you have to change is t.append(a) into something that > tests if a is a number and append something else in that case. > > Depending what you want, you can even do > > s.replace("1","ONE").replace("2","TWO").replace("3","FIVE") > > This is however far from being random ;) > > Have good tests > Laurent Laurent thanks a lot very much!!! really appreciated it.. now i have a good start point thanks again -- http://mail.python.org/mailman/listinfo/python-list
Re: alphanumeric list
On Mar 15, 9:20 am, Chris Rebert wrote: > On Tue, Mar 15, 2011 at 1:10 AM, yqyq22 wrote: > > Hi all, > > I would like to put an alphanumeric string like this one > > EE472A86441AF2E629DE360 in a list, then iterate inside the entire > > string lenght and change each digit with a random digit. > > Do u have some suggestion? thanks a lot > > Can you show us your attempt? > > Cheers, > Chris Hi, to be honest i'm a newbye so i don't know where to start, i began in this way but i don't know how to proceeed. list = (EE472A86441AF2E629DE360) Thanks -- http://mail.python.org/mailman/listinfo/python-list
alphanumeric list
Hi all, I would like to put an alphanumeric string like this one EE472A86441AF2E629DE360 in a list, then iterate inside the entire string lenght and change each digit with a random digit. Do u have some suggestion? thanks a lot -- http://mail.python.org/mailman/listinfo/python-list
Re: http post
On May 28, 5:24 pm, christian schulze wrote: > On 28 Mai, 17:20, yqyq22 wrote: > > > > > > > On May 28, 5:17 pm, christian schulze wrote: > > > > On 28 Mai, 16:47, yqyq22 wrote: > > > > > Hy, i would like to create a little script to reproduce this one > > > > below: > > > > Do you have suggestion? > > > > > POST /folder/path/upload.exe?/dir HTTP/1.1 > > > > Host: 192.168.100.1:8080 > > > > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: > > > > 1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729) > > > > Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/ > > > > *;q=0.8 > > > > Accept-Language: en-us,en;q=0.5 > > > > Accept-Encoding: gzip,deflate > > > > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 > > > > Keep-Alive: 115 > > > > Proxy-Connection: keep-alive > > > > Referer:http://192.168.1.100:8080/dir1 > > > > Content-Type: multipart/form-data; > > > > boundary=---7075104567331 > > > > Content-Length: 539 > > > > Connection: close > > > > > -7075104567331 > > > > Content-Disposition: form-data; name="F1"; filename="file.txt" > > > > Content-Type: application/octet-stream > > > > > -7075104567331 > > > > Content-Disposition: form-data; name="p4" > > > > > -7075104567331-- > > > > > THANKS A LOT > > > > Just send it via a socket? Or use urllib, afair you can send custom > > > HTTP headers.- Hide quoted text - > > > > - Show quoted text - > > > If i understood right i would use only socket.. is it possible? > > thanks > > Yeah i think so, but i am not quite sure. Just test it :)- Hide quoted text - > > - Show quoted text - Do u have an example/link "closed" to my need? thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: http post
On May 28, 5:17 pm, christian schulze wrote: > On 28 Mai, 16:47, yqyq22 wrote: > > > > > > > Hy, i would like to create a little script to reproduce this one > > below: > > Do you have suggestion? > > > POST /folder/path/upload.exe?/dir HTTP/1.1 > > Host: 192.168.100.1:8080 > > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: > > 1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729) > > Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/ > > *;q=0.8 > > Accept-Language: en-us,en;q=0.5 > > Accept-Encoding: gzip,deflate > > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 > > Keep-Alive: 115 > > Proxy-Connection: keep-alive > > Referer:http://192.168.1.100:8080/dir1 > > Content-Type: multipart/form-data; > > boundary=---7075104567331 > > Content-Length: 539 > > Connection: close > > > -7075104567331 > > Content-Disposition: form-data; name="F1"; filename="file.txt" > > Content-Type: application/octet-stream > > > -7075104567331 > > Content-Disposition: form-data; name="p4" > > > -7075104567331-- > > > THANKS A LOT > > Just send it via a socket? Or use urllib, afair you can send custom > HTTP headers.- Hide quoted text - > > - Show quoted text - If i understood right i would use only socket.. is it possible? thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: text file
On Oct 1, 4:03 pm, [EMAIL PROTECTED] wrote: > HI all, > i have some problem with the code belove, i have a list of servers in > a textfile (elencopc.txt) i would to retrieve informations via WMI > ( cicle for ), but i don't understand if the code is correct: > > import win32com.client > import string > import sys > listserver = open('c:\\elencopc.txt','r') > objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator") > objSWbemServices = objWMIService.ConnectServer(listserver,"root > \cimv2") > colItems = objSWbemServices.ExecQuery("Select * from > Win32_QuickFixEngineering") > for objItem in colItems: > print "Caption: ", objItem.Caption > print "Description: ", objItem.Description > print "Fix Comments: ", objItem.FixComments > print "HotFix ID: ", objItem.HotFixID > print "Install Date: ", objItem.InstallDate > print "Installed By: ", objItem.InstalledBy > print "Installed On: ", objItem.InstalledOn > print "Name: ", objItem.Name > print "Service Pack In Effect: ", objItem.ServicePackInEffect > print "Status: ", objItem.Status > > I receive the error : > ile "C:\Python25\Lib\site-packages\win32com\client\dynamic.py", line > 258, in _ApplyTypes_ > result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, > retType, argTypes) + args) > com_error: (-2147352567, 'Exception occurred.', (0, 'SWbemLocator', > 'The RPC server is unavailable. ', None, 0, -2147023174), None) > > MY big dubt is if the code is correct... because if i use vbscript all > works fine.. > thanks a lot in advance My problem is how to translate this vbs in python: Dim fso Dim strComputer Set fso = CreateObject("Scripting.FileSystemObject") Set ElencoPC = fso.OpenTextFile("elencoPC.txt" , 1, False) Do Until ElencoPC.AtEndOfStream strComputer = ElencoPC.ReadLine thanks -- http://mail.python.org/mailman/listinfo/python-list
text file
HI all, i have some problem with the code belove, i have a list of servers in a textfile (elencopc.txt) i would to retrieve informations via WMI ( cicle for ), but i don't understand if the code is correct: import win32com.client import string import sys listserver = open('c:\\elencopc.txt','r') objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator") objSWbemServices = objWMIService.ConnectServer(listserver,"root \cimv2") colItems = objSWbemServices.ExecQuery("Select * from Win32_QuickFixEngineering") for objItem in colItems: print "Caption: ", objItem.Caption print "Description: ", objItem.Description print "Fix Comments: ", objItem.FixComments print "HotFix ID: ", objItem.HotFixID print "Install Date: ", objItem.InstallDate print "Installed By: ", objItem.InstalledBy print "Installed On: ", objItem.InstalledOn print "Name: ", objItem.Name print "Service Pack In Effect: ", objItem.ServicePackInEffect print "Status: ", objItem.Status I receive the error : ile "C:\Python25\Lib\site-packages\win32com\client\dynamic.py", line 258, in _ApplyTypes_ result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType, argTypes) + args) com_error: (-2147352567, 'Exception occurred.', (0, 'SWbemLocator', 'The RPC server is unavailable. ', None, 0, -2147023174), None) MY big dubt is if the code is correct... because if i use vbscript all works fine.. thanks a lot in advance -- http://mail.python.org/mailman/listinfo/python-list
microsoft terminal server
HI, i would like to know if there is a way to create a python script for automate mstsc.exe username and pwd credential, i mean i would create a script that first open mstsc.exe and in the same time is able to fill [computer+username+pwd]. Regards thanks a lot in advance -- http://mail.python.org/mailman/listinfo/python-list
history
Dear all, another little question, I use idle 1.1.2, is there a way to use a history for the command line? thanks in advance -- http://mail.python.org/mailman/listinfo/python-list
remote file
How to open remote file ? example: \\server\share\file.txt thanks a lot -- http://mail.python.org/mailman/listinfo/python-list