- Upvotes Received
- 2
- Posts with Upvotes
- 1
- Upvoting Members
- 2
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
13 Posted Topics
Re: [code] def get_list(): return [raw_input("Please enter a string: ") for i in range(int(raw_input("Please enter the number of strings you want to input\n")))] def shortest(lst): return min(lst, key = len) def longest(lst): return max(lst, key = len) def alpha(lst): return [e for e in lst if e.isalpha()] if __name__ == "__main__": … | |
Re: To be fair, top-down isn't a very descriptive name for the category of grammars. If we're using [url]http://java.sun.com/docs/books/jls/second_edition/html/syntax.doc.html[/url] without any modification, then this grammar is probably not suitable for LL(1). The most obvious problem comes from Selector -> . x | . y | . z However, a LL(2) parser … | |
Re: [code] # Very Loose translation, beware of the globals() and NEVER explicitly translate Perl to Python. See why below. # Assumes that legs, the var referenced by legs, reference, ref, fields, fxall, merge_swap_legs, new_fk_ref, and logg exist if legs in globals(): legs = globals()[legs] else: legs = locals()[legs] if reference … | |
Re: Hi, [code] from ctypes import * from see import see import sys class linknode(Structure): pass linknode._fields_ = [ ("nextNode", POINTER(linknode)), ("intData", c_int), ] class linked_list(): """ our own linked list based on ctypes """ head_node = None def add(self, int_data): node_to_add = linknode(intData = c_int(int_data)) if (self.head_node == None): self.head_node … | |
Re: scp is integrated with ssh so if you can find an openssh server for your platform, you should be in the clear. PS: It's not really recommended to use python for this as there are many steps required to complete this step via scp. If you just need to transfer … | |
Re: well from the top of my head it should be [code]for line in file[/code] instead of the plural form of line. Is this basically how the gist of your script? [code] handle = open("file.file") file = handle.readlines() handle.close() del handle dict = {} for line in file: #Here we just … | |
Re: And this is where apache's httpd.conf comes to the rescue. cd /etc/httpd/conf cat httpd.conf|grep pstats This will give you the grep for the keyword pstats, and it will give you the static location of the files. And now I'm also going to assume that you're running apache+mod_python as opposed to … | |
Re: You do realize that C++ only supports ethernet (class 1) protocols and you must write your own wrapper to use higher level protocols (IP, TCP, + UDP) and generate your own packets. | |
Re: That would return an error since the last 3 objects are arguments. try [code]s = subprocess.Popen(("grep", "-w", "%s"%variable, Data.txt), stdout = subprocess.PIPE) output = s.communicate()[0][/code] | |
Re: I've actually ported the python frontend up to 3.0.1, but I've never had experience with the python C API and apparently the C API had some major changes from 2.x to 3.x so I couldn't continue. Here's my best shot: [url]http://www.python-forum.org/pythonforum/viewtopic.php?f=3&t=14122&p=65820#p65812[/url] | |
Re: os.system doesn't emulate a shell environment so that might be the reason why. Try this [code]from subprocess import PIPE, Popen build = Popen(("devenv.exe", "filename.sln", "/Build"), shell = True)[/code] Alternatively put in the whole path of devenv.exe and see where that leads you. | |
Re: Oh hey, this might help you, I wrote this helper class a while back while doing some work with excel and I decided to upload this onto github a few days ago. [url]http://github.com/leegao/pyXLSX/tree/master[/url] Basic Usage: [code] from xlsx import workbook def lastnums(t,n): return t[len(t)-n:len(t)] Workbook = workbook("workbook.xlsx") extractnums = ("12", … |