[Tutor] Renaming computers

traceyandjoe at tiscali.co.uk traceyandjoe at tiscali.co.uk
Thu Mar 23 21:27:28 CET 2006


Hello there,
Could you point me in the right direction,
after we have ghosted the machines in college
we have to rename them, 
I would like to try and write a program that does this
through matching  the MAC address
with the computer but I'm quite new to
 programming and need some advice on where to start
many thanks 
Joe

>-- Original Message --
>From: tutor-request at python.org
>Subject: Tutor Digest, Vol 25, Issue 54
>To: tutor at python.org
>Reply-To: tutor at python.org
>Date: Wed, 22 Mar 2006 08:14:53 +0100
>
>
>Send Tutor mailing list submissions to
>	tutor at python.org
>
>To subscribe or unsubscribe via the World Wide Web, visit
>	http://mail.python.org/mailman/listinfo/tutor
>or, via email, send a message with subject or body 'help' to
>	tutor-request at python.org
>
>You can reach the person managing the list at
>	tutor-owner at python.org
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of Tutor digest..."
>
>
>Today's Topics:
>
>   1. how to get a line text from input file. (Keo Sophon)
>   2. how to set a value to a block of memory (Keo Sophon)
>   3. Re: Python & MP3 (Bill Burns)
>   4. Re: how to set a value to a block of memory (Kent Johnson)
>   5. Re: how to get a line text from input file. (Kent Johnson)
>   6. Re: Python & MP3 (Gabriel S Farrell)
>   7. Re: how to get a line text from input file. (Danny Yoo)
>   8. Re: how to set a value to a block of memory (Danny Yoo)
>   9. Re: how to set a value to a block of memory (Danny Yoo)
>  10. Hi (Kaushal Shriyan)
>  11. Re: Hi (Danny Yoo)
>  12. Re: Hi (Kaushal Shriyan)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Wed, 22 Mar 2006 08:27:37 +0700
>From: Keo Sophon <keosophon at khmeros.info>
>Subject: [Tutor] how to get a line text from input file.
>To: tutor at python.org
>Message-ID: <200603220827.37194.keosophon at khmeros.info>
>Content-Type: text/plain;  charset="us-ascii"
>
>Hi all,
>
>i am new to programming language and python. I wonder how to get a line
text
>
>from input file.
>
>Thanks,
>sophon
>
>
>------------------------------
>
>Message: 2
>Date: Wed, 22 Mar 2006 08:36:02 +0700
>From: Keo Sophon <keosophon at khmeros.info>
>Subject: [Tutor] how to set a value to a block of memory
>To: tutor at python.org
>Message-ID: <200603220836.02972.keosophon at khmeros.info>
>Content-Type: text/plain;  charset="us-ascii"
>
>Hi all,
>
>How can i set a value to a bytes of block of memory. In C, i think they
use
>
>memset like this.
>
>Thanks,
>Sophon
>
>
>------------------------------
>
>Message: 3
>Date: Tue, 21 Mar 2006 21:35:15 -0500
>From: Bill Burns <billburns at pennswoods.net>
>Subject: Re: [Tutor] Python & MP3
>To: Johanna <johanna.freeman at tiscali.it>
>Cc: Tutor at python.org
>Message-ID: <4420B7E3.7060807 at pennswoods.net>
>Content-Type: text/plain; charset=windows-1252; format=flowed
>
>Johanna wrote:
>> Hallo
>> 
>>  
>> 
>> This is my first post, so hallo to everyone. Im just a newbee with 
>> python so I hope my msg will make some sense. J
>> 
>>  
>> 
>> Is it possible to work with MP3 in python?
>> 
>> I?m looking for a library to modify MP3s (like fade in, fade out, 
>> etc..). I know there are actually some libraries for doing this work 
>> with .wav but I didn?t find one for working with MP3. I?m not sure but
>
>> should be something like -> http://effbot.org/librarybook/wave.htm . Anyone?
>> 
>>  
>
>You may want to have a look at PyMedia:
>
>http://www.pymedia.org/
>
>HTH,
>
>Bill
>
>
>------------------------------
>
>Message: 4
>Date: Tue, 21 Mar 2006 22:17:34 -0500
>From: Kent Johnson <kent37 at tds.net>
>Subject: Re: [Tutor] how to set a value to a block of memory
>Cc: tutor at python.org
>Message-ID: <4420C1CE.7050200 at tds.net>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>Keo Sophon wrote:
>> Hi all,
>> 
>> How can i set a value to a bytes of block of memory. In C, i think they
>use 
>> memset like this.
>
>Python does not support direct access to memory, you will need to use 
>another language or maybe a C extension to Python to do this.
>
>Kent
>
>
>
>------------------------------
>
>Message: 5
>Date: Tue, 21 Mar 2006 22:20:06 -0500
>From: Kent Johnson <kent37 at tds.net>
>Subject: Re: [Tutor] how to get a line text from input file.
>Cc: tutor at python.org
>Message-ID: <4420C266.6090106 at tds.net>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>Keo Sophon wrote:
>> Hi all,
>> 
>> i am new to programming language and python. I wonder how to get a line
>text 
>> from input file.
>
>The simplest Python idiom to do something with each line of a file is this:
>   for line in open('somefile.txt'):
>     # do something with line
>
>You can find out more here:
>http://docs.python.org/tut/node9.html#SECTION009200000000000000000
>
>Kent
>
>
>
>------------------------------
>
>Message: 6
>Date: Wed, 22 Mar 2006 00:17:13 -0500
>From: Gabriel S Farrell <gsf at panix.com>
>Subject: Re: [Tutor] Python & MP3
>To: tutor at python.org
>Message-ID: <20060322051713.GJ1989 at panix.com>
>Content-Type: text/plain; charset=us-ascii
>
>On Tue, Mar 21, 2006 at 09:35:15PM -0500, Bill Burns wrote:
>> Johanna wrote:
>> > Is it possible to work with MP3 in python?
>> > 
>> > I?m looking for a library to modify MP3s (like fade in, fade out, 
>> > etc..). 
>> 
>> You may want to have a look at PyMedia:
>> 
>> http://www.pymedia.org/
>
>I agree with Bill, pymedia looks like the closest thing to what you're
>after.  There's also pyxmms (python-xmms in Debian) if you don't mind
>going through xmms.  pygame might do the trick, also (check out
>http://www.pygame.org/docs/ref/music.html).
>
>gsf
>
>
>------------------------------
>
>Message: 7
>Date: Tue, 21 Mar 2006 21:31:52 -0800 (PST)
>From: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
>Subject: Re: [Tutor] how to get a line text from input file.
>To: Keo Sophon <keosophon at khmeros.info>
>Cc: tutor at python.org
>Message-ID:
>	<Pine.LNX.4.44.0603212129320.1666-100000 at hkn.eecs.berkeley.edu>
>Content-Type: TEXT/PLAIN; charset=US-ASCII
>
>
>
>On Wed, 22 Mar 2006, Keo Sophon wrote:
>
>> i am new to programming language and python. I wonder how to get a line
>> text from input file.
>
>Hi Sophon,
>
>You may want to look at:
>
>    http://wiki.python.org/moin/BeginnersGuide/NonProgrammers
>
>Many of the tutorials there talk about reading from files, including Alan
>Gauld's "How to Program":
>
>    http://www.freenetpages.co.uk/hp/alan.gauld/tutfiles.htm
>
>How are you learning how to program?  Is there a particular tutorial that
>you're reading from?
>
>
>
>------------------------------
>
>Message: 8
>Date: Tue, 21 Mar 2006 21:54:31 -0800 (PST)
>From: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
>Subject: Re: [Tutor] how to set a value to a block of memory
>To: Keo Sophon <keosophon at khmeros.info>
>Cc: Tutor <tutor at python.org>
>Message-ID:
>	<Pine.LNX.4.44.0603212132030.1666-100000 at hkn.eecs.berkeley.edu>
>Content-Type: TEXT/PLAIN; charset=US-ASCII
>
>
>
>On Tue, 21 Mar 2006, Kent Johnson wrote:
>
>> > How can i set a value to a bytes of block of memory. In C, i think
>> > they use memset like this.
>
>Hi Sophon,
>
>Secondary question: why are you trying to do this?  Are you trying to
>represent a collection or "array" of things?
>
>
>Some concepts in C aren't well represented in Python because they only
>make sense from a low-level hardware perspective.  For example, asking for
>an equivalent for C's malloc() or free() functions is "nonsensical" in the
>sense that, since Python is garbage collected, it provides no such
>functions to the casual Python user.
>
>(Such functions ARE available through third-party modules such as SWIG,
>but unless you are really trying to integrate with a C library, you don't
>need this.)
>
>
>As an extended example: C programmers often use malloc() to dynamically
>build structures, such as linked lists:
>
>/**********************************************************/
>/*** C Code **/
>#include <stdio.h>
>#include <stdlib.h>
>
>struct IntList {
>  int first;
>  struct IntList *rest;
>};
>
>struct IntList* construct(int head, struct IntList* rest) {
>  struct IntList* newlist;
>  newlist = malloc(sizeof(struct IntList));
>  newlist->first = head;
>  newlist->rest = rest;
>  return newlist;
>}
>
>void printList(struct IntList* list) {
>  while (list != NULL) {
>    printf("%d\n", list->first);
>    list = list->rest;
>  }
>}
>
>int main() {
>  struct IntList *mylist = NULL;
>  mylist = construct(5, mylist);
>  mylist = construct(1, mylist);
>  mylist = construct(4, mylist);
>  mylist = construct(1, mylist);
>  mylist = construct(3, mylist);
>  printList(mylist);
>  return 0;
>}
>/**********************************************************/
>
>
>But in Python, we can do this structure building without explicitely
>malloc()ing.  The code above has a possible "translation" which looks
>like:
>
>
>############################################
>## Python Code ##
>import sys
>class LinkedList:
>    def __init__(self, first, rest):
>        self.first, self.rest = first, rest
>
>def printList(list):
>    while list != None:
>        print list.first
>        list = list.rest
>
>def main():
>    mylist = None
>    mylist = LinkedList(5, mylist)
>    mylist = LinkedList(1, mylist)
>    mylist = LinkedList(4, mylist)
>    mylist = LinkedList(1, mylist)
>    mylist = LinkedList(3, mylist)
>    printList(mylist)
>    sys.exit(0)
>
>if __name__ == '__main__':
>    main()
>############################################
>
>where most of the low-level details of allocating memory are all handled
>by the Python runtime.
>
>So rather than ask for direct equivalents to C, it might help to ask about
>what you're trying to do.  We'll do what we can to help translate between
>C concepts and Python concepts, and for the most part, what you already
>know will have close analogues.  But some concepts will require a bit of
>tweaking.
>
>
>Good luck!
>
>
>
>
>------------------------------
>
>Message: 9
>Date: Tue, 21 Mar 2006 21:58:23 -0800 (PST)
>From: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
>Subject: Re: [Tutor] how to set a value to a block of memory
>To: Tutor <tutor at python.org>
>Message-ID:
>	<Pine.LNX.4.44.0603212156440.1666-100000 at hkn.eecs.berkeley.edu>
>Content-Type: TEXT/PLAIN; charset=US-ASCII
>
>
>
>> On Tue, 21 Mar 2006, Kent Johnson wrote:
>                       ^^^^^^^^^^^^
>> > > How can i set a value to a bytes of block of memory. In C, i think
>> > > they use memset like this.
>
>
>Whoops, sorry about that Kent!  I completely messed up the attribution
>when cutting-and-pasting.
>
>
>
>------------------------------
>
>Message: 10
>Date: Wed, 22 Mar 2006 12:11:48 +0530
>From: "Kaushal Shriyan" <kaushalshriyan at gmail.com>
>Subject: [Tutor] Hi
>To: tutor at python.org
>Message-ID:
>	<6b16fb4c0603212241g6fb03c9gf61b7baf77217a26 at mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>Hi
>
>I am new to python and I am going through the URL
>http://www.ibiblio.org/obp/thinkCSpy/index.htm, At the moment
>I am going through the Chapter 7 Strings, I am stuck with understanding
>slice which is a part of a String, I am not able to understand how it functions
>
>Awaiting your earnest reply
>
>Thanks in Advance
>
>Regards
>
>Kaushal
>
>
>------------------------------
>
>Message: 11
>Date: Tue, 21 Mar 2006 23:04:36 -0800 (PST)
>From: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
>Subject: Re: [Tutor] Hi
>To: Kaushal Shriyan <kaushalshriyan at gmail.com>
>Cc: tutor at python.org
>Message-ID:
>	<Pine.LNX.4.44.0603212300200.25864-100000 at hkn.eecs.berkeley.edu>
>Content-Type: TEXT/PLAIN; charset=US-ASCII
>
>
>> I am new to python and I am going through the URL
>> http://www.ibiblio.org/obp/thinkCSpy/index.htm, At the moment I am going
>> through the Chapter 7 Strings, I am stuck with understanding slice which
>> is a part of a String, I am not able to understand how it functions
>
>Hello,
>
>
>A "slice" takes a string and returns a "substring" of that string.  For
>example, if we have a string like:
>
>######
>>>> mystring = "supercalifragilisticexpialidocious"
>######
>
>then we can select different portions of the string by indicating the
>start and end positions.  For example, the first ten characters of
>mystring can be extracted using a slice:
>
>######
>>>> mystring[0:10]
>'supercalif'
>######
>
>
>Is this what you are confused about?
>
>Please give us more details on where you're getting stuck, and we will do
>what we can to help clarify.
>
>
>Please continue to reply to 'python-help at python.org': do not email me
>directly. Although I may not personally have the time to answer, I'm sure
>at least one of the other helpers on the list do, so by continuing the
>conversation on python-help, we'll be able to guarantee that your
>questions are not lost.
>
>
>
>------------------------------
>
>Message: 12
>Date: Wed, 22 Mar 2006 12:44:51 +0530
>From: "Kaushal Shriyan" <kaushalshriyan at gmail.com>
>Subject: Re: [Tutor] Hi
>To: tutor at python.org
>Cc: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
>Message-ID:
>	<6b16fb4c0603212314n73ef102an492b330907e7cfcf at mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>On 3/22/06, Danny Yoo <dyoo at hkn.eecs.berkeley.edu> wrote:
>>
>> > I am new to python and I am going through the URL
>> > http://www.ibiblio.org/obp/thinkCSpy/index.htm, At the moment I am going
>> > through the Chapter 7 Strings, I am stuck with understanding slice which
>> > is a part of a String, I am not able to understand how it functions
>>
>> Hello,
>>
>>
>> A "slice" takes a string and returns a "substring" of that string.  For
>> example, if we have a string like:
>>
>> ######
>> >>> mystring = "supercalifragilisticexpialidocious"
>> ######
>>
>> then we can select different portions of the string by indicating the
>> start and end positions.  For example, the first ten characters of
>> mystring can be extracted using a slice:
>>
>> ######
>> >>> mystring[0:10]
>> 'supercalif'
>> ######
>>
>>
>> Is this what you are confused about?
>>
>> Please give us more details on where you're getting stuck, and we will
>do
>> what we can to help clarify.
>>
>>
>> Please continue to reply to 'python-help at python.org': do not email me
>> directly. Although I may not personally have the time to answer, I'm sure
>> at least one of the other helpers on the list do, so by continuing the
>> conversation on python-help, we'll be able to guarantee that your
>> questions are not lost.
>>
>>
>
>Thanks Danny Yoo
>
>I got this, Lets say if its mystring[n:m] where n may be another
>number and m may be another number so how will it work in that case,
>so this becomes general and makes more clear
>
>Lets say if its mystring[3:8] so how will i evaluate it
>
>Thanks for all the help
>
>Regards
>
>Kaushal
>
>
>------------------------------
>
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>
>End of Tutor Digest, Vol 25, Issue 54
>*************************************


___________________________________________________________

Tiscali Broadband from 14.99 with free setup!
http://www.tiscali.co.uk/products/broadband/




More information about the Tutor mailing list