Re: [Tutor] need a hint
I realize the code snippet was bad. It was meant to be pseudo code. I was on my phone and far from pc. Anyway I tried this: already_seen = set() for name in last_names: if name in already_seen: print("Already seen", name) else: already_seen.add(name) I am not seeing a pattern in the output to give me a clue as to why it is doing this. Also, it seems to be referencing chars when variable lastName is an item in a list. Unexpected output: Python 3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> RESTART >>> Already seen s Already seen s Already seen k Already seen r Already seen o Already seen e Already seen i Already seen n Already seen l Already seen n Already seen e Already seen l Already seen r Already seen o Already seen s Already seen s Already seen o Already seen n Already seen l Already seen s Already seen n Already seen l Already seen t Already seen l Already seen k Already seen i Already seen r Already seen n Already seen l Already seen u Already seen e Already seen n Already seen l Already seen e Already seen h Already seen e Already seen t Already seen e Already seen e Already seen n Already seen e Already seen l Already seen i Already seen l Already seen i Already seen r Already seen a Already seen e Already seen e Already seen o Already seen e Already seen h Already seen e Already seen a Already seen t Already seen o Already seen n Already seen e Already seen r Already seen n Already seen e Already seen r Already seen r Already seen l Already seen e Already seen l Already seen e Already seen n Already seen o Already seen n Already seen r Already seen a Already seen s ['John Cornyn (R)', 'Ted Cruz (R)'] New Mexico Here is all my code: def createList( filename ): # print( filename ) senateInfo = {} try: info = open( filename, "r" ) for line in info: # print( line ) dataOnLine = line.split( "\t" ) state = dataOnLine[ 0 ] senator = dataOnLine[ 1 ] if state in senateInfo: # Adding another senator. # Create a list of the both senators from that state. incumbent = senateInfo[state] senators = [ incumbent, senator ] senateInfo[state] = senators else: senateInfo[state] = senator #print( senateInfo ) info.close() except: print( filename, " did not open! qUITTING." ) return senateInfo def createList2(filename): List = [] senateInfo2 = {} info = open( filename, "r" ) for line in info: dataOnLine = line.split( "\t" ) state = dataOnLine[ 0 ] senator = dataOnLine[ 1 ] nameSplit = dataOnLine[ 1 ].split(" ") if len(nameSplit) == 3: lastName = nameSplit[1] elif len(nameSplit) == 4: lastName = nameSplit[2] already_seen = set() for name in lastName: if name in already_seen: print("Already seen", name) else: already_seen.add(name) senateInfo2[lastName] = state info.close() return senateInfo2 def test( state, senatorsInfo ): print( senatorsInfo[state] ) def test2( senator, usSenators ): print( usSenators[senator] ) def main(): usSenators = createList( "USSenators.txt" ) usSenators2 = createList2( "USSenators.txt" ) test( "Texas", usSenators ) test2("Udall", usSenators2 ) main() On Tue, Dec 3, 2013 at 7:54 PM, Steven D'Aprano wrote: > On Tue, Dec 03, 2013 at 11:55:30AM -0600, Byron Ruffin wrote: > > What I am having trouble with is finding a way to say: if lastName > appears > > more than once, print something. > > > > I ran a bit of code: > > For x in lastname > > If lastname = udall > >Print something > > You most certainly did not run that. That's not Python code. Precision > and accuracy is vital when programming. Please tell us what you > *actually* ran, not some vague summary which may or may not be in the > right ballpark. > > Copy and paste is your friend here: copy and paste the block of code you > ran, don't re-type it from memory. > > > This prints x twice. > > > > I think what I might be hung up on is understanding the ways that I can > use > > a loop. I know I need to loop through the list of names, which I have, > and > > set a condition dor the apppearance of a string occurring more than once > in > > a list but I do
Re: [Tutor] need a hint
What I am having trouble with is finding a way to say: if lastName appears more than once, print something. I ran a bit of code: For x in lastname If lastname = udall Print something This prints x twice. I think what I might be hung up on is understanding the ways that I can use a loop. I know I need to loop through the list of names, which I have, and set a condition dor the apppearance of a string occurring more than once in a list but I don't know how to translate this to code. How do I say: if you see it twice, do something? On 2 December 2013 02:25, Byron Ruffin wrote: > > The following program works and does what I want except for one last problem > I need to handle. The program reads a txt file of senators and their > associated states and when I input the last name it gives me their state. > The problem is "Udall". There are two of them. The txt file is read by > line and put into a dictionary with the names split. I need a process to > handle duplicate names. Preferably one that will always work even if the > txt file was changed/updated. I don't want the process to handle the name > "Udall" specifically. For a duplicate name I would like to tell the user > it is not a unique last name and then tell them to enter first name and then > return the state of that senator. You're currently doing this: > senateInfo = {} > senateInfo[lastName] = state Instead of storing just a state in the dict you could store a list of states e.g.: senateInfo[lastName] = [state] Then when you find a lastName that is already in the dict you can do: senateInfo[lastName].append(state) to append the new state to the existing list of states. You'll need a way to test if a particular lastName is already in the dict e.g.: if lastName in senateInfo: Oscar ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] need a hint
The following program works and does what I want except for one last problem I need to handle. The program reads a txt file of senators and their associated states and when I input the last name it gives me their state. The problem is "Udall". There are two of them. The txt file is read by line and put into a dictionary with the names split. I need a process to handle duplicate names. Preferably one that will always work even if the txt file was changed/updated. I don't want the process to handle the name "Udall" specifically. For a duplicate name I would like to tell the user it is not a unique last name and then tell them to enter first name and then return the state of that senator. Thanks An excerpt of txt file... ArkansasMark Pryor (D)20032015 ArkansasJohn Boozman (R)20112017 CaliforniaDianne Feinstein (D)19922019 CaliforniaBarbara Boxer (D)19932017 ColoradoMark Udall (D)20092015 ColoradoMichael F. Bennet (D)20092017 def createList(state): senateInfo = {} info = open( "USSenators.txt", "r" ) for line in info: dataOnLine = line.split( "\t" ) state = dataOnLine[ 0 ] senator = dataOnLine[ 1 ] nameSplit = dataOnLine[ 1 ].split(" ") if len(nameSplit) == 3: lastName = nameSplit[1] elif len(nameSplit) == 4: lastName = nameSplit[2] senateInfo[lastName] = state info.close() return senateInfo def test( senator, usSenators ): print( usSenators[senator] ) def main(): usSenators = createList( "USSenators.txt" ) senator = input("Enter last name of Senator") test(senator, usSenators ) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] ideas?
Need a little help with finding a process for this: when a string of text is input, for example: abc def. I want to have each letter shift to the right one place in the alphabet. Thus.. abc def would be output as bcd efg. Any ideas on how to do this? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] loop running twice?
def main(): goal, apr, deposit = getSavingsDetails() determineMonthsTilSaved( goal, apr, deposit ) months = determineMonthsTilSaved(goal, apr, deposit) summarize( months ) def getSavingsDetails(): """ goal = float( input( "Principal sought? $" ) ) apr = float( input( "Interest rate? " ) ) deposit = float( input( "Deposit? $" ) ) """ goal = 1000.0 apr = .05 deposit = 100 return goal, apr, deposit def determineMonthsTilSaved( goal, apr, deposit ): months = 0 saved = 0 totalInterest = 0.0 while saved < goal: interest = saved * apr / 12 totalInterest += interest saved += (deposit + interest) months += 1 print( months, ("%.2f" % saved), ("%.2f" % totalInterest) ) return months def summarize( months ): print( "Saved! It took ", months // 12, "years and", months % 12, "months." ) main() When this is run it appears that determineMonthsTilSaved is running twice before the loop ends. It is supposed to run until saved > than goal, but look at the output. It runs again even after saved > goal. Help please? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] basic function concept
def main(x, y, z): print (x, y, z) def funct(): x = 1 y = 2 z = 3 return x, y, z main() Can someone tell me why main is not being given any arguments? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] space between words printed
The output generates a sentence made up of words chosen randomly from lists. I am having trouble getting a space between each of the words. Should I be thinking about .split? Here is the code (ignore indent errors as it was copied and pasted) Thank you: import random def wordList(): adj1 = ["Big","Small", "Early", "Late","Red", "Tall","Short"] subj = ["politician", "man","woman", "whale", "company", "child", "soldier"] obj = ["budget", "money", "box","gift","gun", "tank","drone"] adj2 = ["hot","crazy", "stupid", "fast","worthless", "awesome", "dirty"] verb = ["spends", "shoots", "evades", "pursues", "subverts", "passes", "flirts"] y = adj1[generate()], subj[generate()] + obj[generate()] + adj2[generate()] + verb[generate()] return y def generate(): random0_6 = random.randint(0, 6) return random0_6 def main(): print (wordList(), ".", sep="") main() ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] cs student needs help import math
I am writing a simple program based off an ipo chart that I did correctly. I need to use ceil but I keep getting an error saying ceil is not defined. I did import math, I think. I am using 3.2.3 and I imported this way... >>> import math >>> math.pi 3.141592653589793 >>> math.ceil(math.pi) 4 >>> math.floor(math.pi) 3 ... but I get the error when using ceil... pepsticks = ceil(peplength / StickLength) Traceback (most recent call last): File "", line 1, in pepsticks = ceil(peplength / StickLength) NameError: name 'ceil' is not defined Thanks for the help! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] python books
David Holland wrote: > The best book I found was python programming for the > absolute beginner by Michael Dawson. I would strongly > recommend it. Yes, I would agree 100%. Michael Dawson does an excellent job teaching Python to beginners. (Most others don't come close to his book, in my opinion.) Byron --- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python books: buying advice needed
Hi David, The answer depends. If you are looking for free resources, I would recommend checking out: http://www.greenteapress.com However, if you are looking for a professional-grade book, then I would recommend "Python Programming for the Absolute Beginner." I, personally speaking, found this book to be an excellent resource -- I would highly recommend it. Byron --- David Stotijn wrote: > Hi, > > I'm planning on buying a book to help me learn Python. Some of the books > I'm considering are a few years old and based on an older version of > Python (e.g. 2.3). > Is it wise to buy a book based on an older version? Are the principles > and methods used in those books outdated by now? > Ideally, the book I'm looking for has some "best practice" guidelines > and alot of example code. > > Do you have any tips? > > Thanks in advance! > > David > > > > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Why won't it enter the quiz? (off topic)
Poor Yorick wrote: > Once again you're implying that there's something wrong with Nathan > asking for help on this list. Blow it out your hairdo... No, I did not imply or state that at all. In fact, I was answering your own statement in which you posted the following valid argument: > "I'd bet that almost EVERYONE on this list is selling software with > the __skills__ they may have picked up here." Notice your beautiful keyword there -- "skills." Yes, I agree with your statement 100%. Not a problem at all. However, anytime that one directly copies code from someone else, (at least within the United States), you run the risk of copyright violation and getting sued. That's not an issue here, but in real life, one needs to be aware of this. Not all people are as nice and wonderful as you will find in a teaching forum, such as this. As a college-level teacher, it is important that an education be more than knowing how to write code -- it has to do with learning successful business practices too. :-) (Ones that will keep you out of the court room, at least!) Brian --- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Why won't it enter the quiz?
Nathan Pinno wrote: > Brian and all, > > I am just asking for help - after all I write most each program myself, > and just ask for help in debugging it whenever I cannot figure it out. > If this is being sneaky, I apologize, and won't ask for help anymore. No, don't do that... Happy that you are asking questions! I was humored by the idea that you have a GREAT business model there... :-) FREE Labor -- wow, should of thought of that one earlier... Have a great weekend and hope you keep posting! Brian --- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Why won't it enter the quiz? (off topic)
Hi Nathan C, No, I was not saying that he needed to stop. However, I thought it was kind of funny / entertaining that the tutors here are helping to develop his code for free -- and then he gets to sell it online! Quite the efficient business model there... :-) PS> No, (for the record only), there is a HUGE difference between selling "skills" and selling code that someone else wrote. :-D Brian --- Nathan Coulter wrote: > Byron wrote: > >>Hi Nathan, >> >>Wow, I have to give you some good credit -- you are quite the sneaky and >>innovative business guy. You get the free tutors here to help write >>your programs and when they are finished, you sell them on your website >>for $20.00 each! I bet more businesses wish they could do business the >>way you do! Quite efficient, I must admit... >> > > I'd bet that almost EVERYONE on this list is selling software with the skills > they may have picked up here. There's nothing wrong with that! And any of > Nathan's customer's that want to try to build it themselves are free to look > here on the list to see exactly how he did it. Kudos, Nathan! > > Bye, > Poor Yorick > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Why won't it enter the quiz?
Hi Nathan, Wow, I have to give you some good credit -- you are quite the sneaky and innovative business guy. You get the free tutors here to help write your programs and when they are finished, you sell them on your website for $20.00 each! I bet more businesses wish they could do business the way you do! Quite efficient, I must admit... Take care, Brian --- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Is there an easy way to combine dictionaries?
Lane, Frank L wrote: > Is there an easy way to combine dictionaries? Hi Frank, Yes, there is -- please see the "addDict" method that I have provided below: Byron --- def addDicts(a, b): c = {} for item in a: c[item] = a[item] for item in b: c[item] = b[item] return c a = {'a':'a', 'b':'b', 'c':'c'} b = {'1':1, '2':2, '3':3} c = addDicts(a, b) print c ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Game Engine HowTos?
Joseph Quigley wrote: > Pygame? Well I'll take a look... do they have documentation for Game > Engine writing? I know that PyGame is a Python-based game engine in which one can use to write / develop computer games. However, I am not sure if they allow you to be able to "re-write" the engine itself. If you check their site, which seems to be well documented, I am sure that you can find out. Byron --- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Program to lock folders under win32
Oliver Maunder wrote: > There's a program called Magic Folders which does this - > http://www.pc-magic.com/des.htm#mf > This actually hides the folders, rather than locking them. However, it > seems to be integrated with the operating system at a very low level. I > don't think you'd be able to get this kind of integration with a Python > program. Hi Oliver, Yeah, Magic Folders used to be a favorite program of mine. Only problem (that I knew it used to have -- the problem still might be there, not sure) is that if you used any of the Windows "repair" or maintenance tools on your system, such as defrag or diskscan, you can lose your data. Magic Folders creates a file system on the hard drive that "looks" like lost clusters. Because of this, Windows jumps in and tries to "fix" it for you. Not good! ;-) Byron --- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Program to lock folders under win32
>>I want to make a program to lock folders (so the user can only access >>them if he knows the password) under win32, the only problem is that I >>have no idea how to start or what to do. Do you guys have any ideas of >>how to do it? Normally, one would accomplish this via Windows file / folder permissions. However, it also requires that you are working with a MS Windows domain server environment. If you wish to accomplish this using non-Microsoft technology, you can always use a password protected web folder. It will provide read only access. If you wish to provide uploading rights, then you can always setup FTP abilities, etc. Byron --- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Game Engine HowTos?
Joseph Quigley wrote: > Or does anyone know of a good Game Engine writing tutorial in another > language? I believe this is what you are looking for: http://www.pygame.org/ Byron --- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Importing a List from Module
Tom Strickland wrote: > In my "main" module I import "enterData" and try to read the first > element of "close" as follows: > > import enterData > xy=enterData.close > print xy[0] > > > When I do this it prints out the entire "close" list, not just the first > term. Hi Tom, I would create a function in your module that returns the list. Here's a quick, simplified example: def returnList(): newList = [] newList += [123.45] newList += [529.59] newList += [259.92] return newList aList = returnList() print aList Note the return statement... This enables assignment, as you have done in "xy=enterData.returnList()" Hope this helps, Byron --- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Generate 8 digit random number
Hi Alberto, Here's how to do it: --- import random def generateKey(): nums = "0123456789" strNumber = "" count = 0 while (count < 8): strNumber += nums[random.randrange(len(nums))] count += 1 print strNumber # A quick test... count = 0 while (count < 1): generateKey() count += 1 --- Byron :-) --- Alberto Troiano wrote: > Hi everyone > > I need to generate a password..It has to be an 8 digit number and it has to > be random > > The code I've been trying is the following: > > > import random > random.randrange(,) > > The code works but sometimes it picks a number with 7 digits. Is there any > way that I can tell him to select always a random number with 8 digits? > > Thanks in advanced > > Alberto > > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Working with files
Bob Gailer wrote: > read the file into a string variable (assuming the file is not humungus) > find the location of "something" in the string > assemble a new string consisting of: >the original string up to the location (index) of "something" >"what" >the rest of the original string > write the new string to the file Hi Scott, Bob gave you the basic instructions that you need to complete the task that you are asking for. If you don't know how to do this, I would suggest that you start with the following Python tutorial: http://www.greenteapress.com They provide an excellent tutorial for learning the basics of Python -- and best of all, it's free and written for absolute beginners. Take care, Byron --- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Remove a number from a string
Shitiz Bansal wrote: > Hi, > Suppose i have a string '347 liverpool street'. > I want to remove all the numbers coming at the starting of the string. > I can think of a few ways but whats the cleanest way to do it? > > Shitiz Here's a function that can do what you're wanting to accomplish: Byron --- def removeNums(addr): text = addr.split() revisedAddr = "" for item in text: try: i = int(item) except: revisedAddr += item + " " return revisedAddr.strip() # Test the function... ;-) address = "5291 E. 24rd Ave." print removeNums(address) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Counting help
Hi Scott, The site ( http://www.greenteapress.com ) has a wonderful tutorial on it for Python that quickly teaches one (within a few minutes) how to work with dictionaries. I would highly recommend that you check it out. It's well worth it... Byron ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Counting help
Luis N wrote: >Ideally, you would put your names into a list or dictionary to make >working with them easier. If all you're trying to do is count them >(and your list of names is long), you might consider a dictionary >which you would use like so: > >#This is just the first thing I considered. > >l = ['a list of names'] > >d = {} > >for name in namelist: >if d.has_key(name): >x = d.get(name) >d[name] = x + 1 >else: >d[name] = 1 > 100% agreed. I have used this approach before and it works great... Byron ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Writing to text files
Byron wrote: > Hi Danny, > > I agree 100% with your statement. The reason why I left it in its > "fragile" state was to help keep the example provided simple and > straight forward. Since this is a "beginners" group, I wanted to > confuse by adding extra protection to it. ;-) > > Byron > --- Opps, a quick correction: "I wanted to *avoid* confusion by..." Byron --- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Writing to text files
Danny Yoo wrote: > > >>It's actually fairly simply and straight forward... Here's how to do >>it: (I haven't officially tested this code for bugs, but I believe it >>is correct.) >> >>file = open("datafile.txt", "r") >>filedata = file.read() >>file.close() >> >>newLine = "Your new line of data with the time stamp goes here.\n" + >>filedata >>file = open("datafile.txt", "w") >>file.write(newLine) >>file.close() >> >> > >Hi Byron, > >The approach here is fine, but it's slightly fragile, because if anything >exceptional happens in-between writing the lines back to the file, we can >lose the data in the file. It might be safe to first backup the original >file by renaming it to something else. > Hi Danny, I agree 100% with your statement. The reason why I left it in its "fragile" state was to help keep the example provided simple and straight forward. Since this is a "beginners" group, I wanted to confuse by adding extra protection to it. ;-) Byron --- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Writing to text files
Hi Johan, It's actually fairly simply and straight forward... Here's how to do it: (I haven't officially tested this code for bugs, but I believe it is correct.) file = open("datafile.txt", "r") filedata = file.read() file.close() newLine = "Your new line of data with the time stamp goes here.\n" + filedata file = open("datafile.txt", "w") file.write(newLine) file.close() --- Hope this helps, Byron :-) --- Johan Geldenhuys wrote: > Hi all, > I want to write to a text file with a timestamp, but I want to newest > entry at the top. So I want to insert the next entry to the file at > the beginning. > I can create and append to a file and then the latest entry is at the > bottom. > Any ideas how this is done please? > > Thanks, > > Johan > > > >___ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor > > ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Network Programming Information and terminology
Hi John, Here is a link that you might find useful: *http://compnetworking.about.com/od/basicnetworkingconcepts/* --- Listed below are two very basic Python IM programs. You'll need to run the server first -- let it run in the background. Once this is running, start the second program, which allows you to type in a message and then the server program will acknowledge the reception of the data and then send a message back to you. --- # PYTHON SERVER import socket # Create connection. mySocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) mySocket.bind(('', 2727)) while True: # Get data coming in from client. data, client = mySocket.recvfrom(100) print 'We have received a datagram from', client, '.' print data # Send a response to confirm reception! mySocket.sendto ( 'Message confirmed: ' + data, client ) --- # Client program from socket import * # Set the socket parameters host = "127.0.0.1" port = 2727 buf = 1024 addr = (host,port) # Create socket UDPSock = socket(AF_INET,SOCK_DGRAM) def_msg = "===Enter message to send to server==="; print "\n", def_msg # Send messages while (1): data = raw_input('>> ') if not data: break else: if(UDPSock.sendto(data,addr)): print "Sending message '",data,"'." # Receive the response back from the server. data, client = UDPSock.recvfrom(100) print data # Close socket UDPSock.close() --- Hope this helps, Byron --- John Walton wrote: >Hello. It's me again. Thanks for all the help with >the Python Networking Resources, but does anyone know >what I'll need to know to write a paper on Network >Programming and Python. Like terminology and all >that. Maybe I'll have a section on socketets, TCP, >Clients (half of the stuff I don't even know what it >means). So, does anyone know any good websites with >Network Programming information. Thanks! > >John > >__ >Do You Yahoo!? >Tired of spam? Yahoo! Mail has the best spam protection around >http://mail.yahoo.com >___ >Tutor maillist - [EMAIL PROTECTED] >http://mail.python.org/mailman/listinfo/tutor > > > ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] HELP ME DUDE
Quoting Suranga Sarukkali <[EMAIL PROTECTED]>: > Hay, you know what? when I connect to the internet the modem software(Error > Free Software for Sure) say's a around 50-53.3Kbps connected though when I > download a file from a server not p2ps or any of the kind service the > downloads are even when connection is idle without any other method of > bandwidth usage the downloads are at 4 Kilobytes per second but that should > be around 8 Kilobytes per second as a thumb rule, you know that right? so I > wonder is it's the malware or any type or WHAT could be the reason or even > not how to get the said 53.3k (8KBs per second) download rate to my pc? oh > remember to reply to me as soon as possible. Hi Suranga, This is a Python programming group. If you have any Python questions, then this is the place to ask them. However, Anything outside of that scope will probably not get you too much help. ;-) Byron --- This message was sent using IMP, the Internet Messaging Program. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Please Help: Hacking
Quoting Jeremy Jones <[EMAIL PROTECTED]>: > Here you go. This should be enlightening: > > http://www.catb.org/~esr/writings/unix-koans/script-kiddie.html Hi Jeremy, That's great... Thanks for sharing the link. Byron --- This message was sent using IMP, the Internet Messaging Program. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] hello
Yes, it is. :-) Byron --- Quoting dina lenning <[EMAIL PROTECTED]>: > is this where i send my questions?? This message was sent using IMP, the Internet Messaging Program. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Getting singal strength of the received packet
sunny sunny wrote: >Hi, > >I am sending and receiving for a simple server application over wirless link. >Can I get the signal strength of the received packet in Python? > Isn't this done strictly at the hardware level of the NIC? I don't believe that one can get this information from Python. Byron ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] OT python Licences
Dave S wrote: >That being the case am I right in thinking that my script would also >have to be GPL and I would have to inform my employer as I hand it over ? > > I don't believe so. Python prefers to encourage its developers to contribute to the general community. However, you can commercially write apps in Python and then sell them -- without having to make them open source or give-awayable to the general community. Hope this helps, Byron --- -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.8.12/46 - Release Date: 7/11/2005 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] What's going on with this code? Error message supplied.
Hi Nathan, It appears that you are just starting to learn the Python programming language. May I suggest that you check out the following FREE resources -- they will help to get you started and running smoothly with Python. Learning With Python http://www.greenteapress.com/thinkpython/ After you have gone though that tutorial, I would then recommend the following advanced materials: http://www.devshed.com/c/b/Python/ HTHs (Hope this helps), Byron --- -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.8.11/44 - Release Date: 7/8/2005 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Is it possible to...
Alan G wrote: >> I was just wondering if it is possible to use Python as a language to >> password protect a webpage? > > > Yes it is possible but you will need to have a web server that can run > Pyhon and there aren't too many of those on the internet... > > However, there are some hosters that do allow Python scripts. If you search google for "web hosters" + Python, you will find a variety of them. One that looks interesting is: http://www.synergyconnect.com/Linux_Plans/Linux/Linux_Web_Hosting_Plans/ > OTOH if its a privately owned web server then password protection is > usually a standard configuration item of the web server, you just edit > a file and tell it to password protect a particular file or folder. > Certainly Apache and Xitami work like that, no coding needed. > I agree. This is by far, the best option -- however, if Nathan is wanting to learn how to password protect a page using Python technology, I would recommend that he check out the following page: http://www.devshed.com/c/a/Python/Python-on-the-Web/ HTHs, Byron --- -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.8.11/44 - Release Date: 7/8/2005 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor