225 Posted Topics
Re: It can be just me, but it seems something is wrong! Can you explain a little further. You want to know the words that exist in the two files, is that it? Or do you want to count the ocurrences in each file? | |
Re: I believe it's a simple path problem, since they are common on win. Try to create a shortcut for the application, setting the 'start in' option to that folder. | |
Re: [URL="http://www.daniweb.com/forums/thread88479.html"]Look here![/URL] A little search helps. ;) Happy coding! | |
Re: [URL="http://docs.python.org/library/stdtypes.html?highlight=partition#str.partition"]Partition![/URL] | |
Re: Can you try this? [CODE]body = {'user': user, 'pswd': passo, 'submit.x': '39', 'submit.y': '7'}[/CODE] | |
Re: This should give you some insight! [CODE]import csv for row in csv.reader(open('timeline1.csv', 'r')): match = None for item in row: if item.find('.ie/') != -1: match = True if match: print 'Highlighted ->>', row else: print row[/CODE] I'm not a tk programmer, but: [CODE]def searchfilt(self): f = open("timeline1.csv", "r") reader = … | |
Re: [CODE]f = open('filename.rc') old_rc = f.readlines() f.close() host = 'PARTYHOST' new_ip = '127.0.0.1' f = open('filename.rc', 'w') for i in range(len(old_rc)): if old_rc[i].find(host) != -1: f.write('%s %s\n' % (host, new_ip)) #You should check the newline else: f.write(old_rc[i]) f.close()[/CODE] | |
Re: Do you have some code? Can you post a sample csv file? Happy codding! | |
Re: [URL="http://www.linuxjournal.com/content/convert-spreadsheets-csv-files-python-and-pyuno-part-2"]Some insights[/URL], and [URL="http://gis.utah.gov/code-python/python-convert-ms-excel-to-csv"]some more[/URL]! Hope it helps! Happy coding! | |
Re: Like this? [CODE]if(empty($veh_img) AND empty($disk_img)){ $galpic="image.gif"; }else{ $galpic="$disk_img"; }[/CODE] | |
Re: [CODE]def squareEach(nums): squares=[] for number in nums: squares += [number * number] return squares[/CODE] | |
Re: [CODE]if(!strcmp($row['dtFirstContactSt'], '0000-00-00') AND !strcmp($row['dtMarketingSt'], '0000-00-00')) { echo "<td width='156'>" . "  </td>"; } else { echo "<td bgcolor=FF0000 width='156'>" .$row['dtFirstContactSt']. "</td>"; }[/CODE] | |
Re: Can you explain a little further? Have you loaded the image? | |
Re: Use pprint, or some tabbed printing, so it looks like a table. | |
Re: Have you tried like this? [CODE]r = csv.reader(open('v20100515.csv', 'rb'))[/CODE] EDIT: Sorry i began the reply and went eat some sandwich, finnished when I came, and there were already all this ones posted, but I didn't saw them. | |
Re: [CODE]from random import randint color = (randint(0, 255), randint(0, 255), randint(0, 255))[/CODE] | |
Re: Maybe like this. [CODE]str1 = "Hello Monty Python!" str2 = str1.replace('M', 'Spam') str3 = str2.replace('P', 'Spam') def print_str(str1, str2, str3): print(str1) print(str2) print(str3) print_str()[/CODE] or [CODE]str1 = "Hello Monty Python!" str2 = str1.replace('M', 'Spam') str3 = str2.replace('P', 'Spam') print('%s\n%s\n%s' % (str1, str2, str3))[/CODE] | |
Re: You can do a select first to see if it exits, and delete thereafter if exists, or give error message if it doesn't. | |
Re: I guess it is [CODE]windowSurface.blit(pi, 25, 25) or windowSurface.blit(pi, (25, 25))[/CODE] but i never used pygame. | |
Re: You need to find a way to simulate a pressed key. I have a key simulator somewhere. I'll search and say something when I get home. | |
Re: The concept is the same as in this [URL="http://www.daniweb.com/code/snippet278635.html"]Tech B snippet[/URL]. Give it a try, Happy coding. | |
Re: Can you show, or at lest say wich type of server you implemented? You can use the sockets as files, passing and reading from them the coordinates. | |
Re: [QUOTE]Assuming you have a script called hello.py which you want to turn into an executable, this can be accomplished by this command: cxfreeze hello.py --target-dir dist[/QUOTE] [URL="http://cx-freeze.sourceforge.net/cx_Freeze.html"]Source[/URL] You must run the cx_freeze script to modify your script, you don't include or import cx_freeze on your scripts. The info you misunderstood, … | |
Re: Do a litle search on the forum, theres a lot of CSV search and modify examples. Write a tryout, and post the results, with input files and desired output. Happy coding | |
Re: Sometihing is wrong, since urllib2 should give you the same source code for the page. | |
Re: The working file, is the file wich you are processing. The one that you create or open, and read or write to it. | |
Re: Just take the break out, and it will read all lines, indicating all errored ones. | |
Re: Have you tried withou using the ie.PollWhileBusy() calls? Every example I saw doesn't use it, like the example in the module documentation: [CODE] import IEC ie = IEC.IEController() # Creates a new IE Window ie.Navigate('http://www.google.com/') # Navigate to a website. html = ie.GetDocumentHTML() # Get the HTML [/CODE] and it … | |
Re: [URL="http://cx-freeze.sourceforge.net/cx_Freeze.html"]Here??[/URL] | |
Re: Something like this can do it also: [CODE]overwrite = None print w.fill('WIP will create Backup, Resized and Watermarked folders to store the original, resized and watermarked pictures. It will overwrite them if they already exists. Are you sure you want to continue (y/n)?') While overwrite.lower() != 'n' and overwrite.lower() != … | |
Re: You can if you calculate the factor of the resize, and use it to calculate the other dimension. I think thats the only solution. | |
Re: This checks if the path exists, and if don't it creates it. [URL="http://docs.python.org/library/os.path.html"]More info.[/URL] [CODE]if not os.path.exists('Backup'): os.mkdir('Backup') [/CODE] | |
Re: It's like this, theres no python module for that, but you can write one using the Symbian C++ SDK API Plug-in package for S60 3rd Edition, Feature Pack 2 wich includes the Phone Client USSD API. | |
Re: Quick Fix [CODE]from sys import path path.append('path_to_files')[/CODE] | |
Re: About the cycle. [CODE]countries = open('languages/country.lang', 'r').readlines() for i in range (0, len(countries): vars()['A%s' % i + 1] = countries[i][/CODE] | |
Re: You can create semaphores and work with locks. To me, if you tried all those possibilities. I think you just messing something. | |
Re: Can you explain what you mean with [QUOTE]I'm trying to do pretty much the same thing[/QUOTE] It's exactly the same code? Is it some adjusted version? Where is it? Can you post a logfile example? More info please. Happy coding!! :D | |
| |
Re: You should take a look at the [URL="http://docs.python.org/library/sys.html"]sys[/URL] module. | |
Re: Because of this line: [CODE]bin=2[/CODE] it should be something like: [CODE]bin_n = bin(2) r = bin_n ** n_input[/CODE] | |
Re: Error message or something like that? | |
Re: I don't know much about OOP. But shouldn't it be like that. And about the replace, can you post the error message??? [CODE]import csv class MyDialect(csv.excel): self.lineterminator = "\n" # here csv.register_dialect("myDialect", MyDialect) cr = csv.reader(open("data.csv","rb"), dialect = "myDialect") cw = csv.writer(open("clean_data.csv", "wb")) crlf = '\r\n' for row in cr: … | |
Re: Can you explain better or give some code? | |
Re: and wheres the code of that part where you type a folder name to see it's contents. | |
Re: And how are those clusters. I see that you want to search for the value on the fisrt column of the first file, I just don't know what would be a valid match on the second one. A cluster that doesn't have some values, tat has some values uin some … | |
Re: you can search for the modules in the file search. It seems like a path problem. | |
Re: Lazy simple mode. [CODE]f_in = open('output.txt').readlines() for line in f_in: if 'Currently active records' in line: _, _, _, active_records = line.split(' ') print active_records[/CODE] | |
Re: list of int [CODE]list3 = [[int(x) for x in y] for y in list2][/CODE] | |
Re: Like this. [CODE]f_in = open('problem.txt').readlines() f_out = open('code_solution.txt', 'w') for line in f_in: filtered = [] data = line.rstrip('\n') [filtered.append(x) for x in data.split(' ')] count, numb1, numb2, name, letter = [x for x in filtered if x != ''] print count, numb1, numb2, name, letter # not needed for … | |
Re: Try this. You had unneeded brackets. [CODE]for i in range(int(P)): for j in range(int(A)): float(popdata[i][j])[/CODE] |
The End.