15,175 Topics
| |
How do I use glob with urllib2? So what I have been trying to acheive with no success is creating a list of file names with glob from two sources and comparing them and download file if it doesn't exist. I can't get past the start because I am not … | |
Hello, I get following error while importing h5py. Can some one please help me in how does this work. import h5py File "/usr/lib/python2.6/site-packages/h5py-1.3.1-py2.6-linux-x86_64.egg/h5py/__init__.py", line 24, in <module> import h5 File "h5.pyx", line 386, in init h5py.h5 (h5py/h5.c:5557) File "h5.pyx", line 359, in h5py.h5.init_hdf5 (h5py/h5.c:3946) File "h5r.pxd", line 24, in init … | |
So I'm creating a backup GUI in Python which basically asks the user for their username/password and source directory so it can be rsynced over to a remote server. The only trouble I'm coming across is passing the password (entered in the GUI) to the server after I execute the … | |
Regular Expression (RE) They can be used with string operations. Using this, we specify the rules for the set of possible strings that we want to match (Searching for patterns in another string). Note : its finds FIRST instance of that pattern We can also use REs to modify a … | |
hii, i am new to python.. i want to run a batch file on a remote computer by running python script on my computer both in the same network. i am able to run batch file on my computer in python script using subprocess, but not able to access the … | |
I am using the following code to extract second name from the html having following kind of lines - <tr align="right"><td>3</td><td>Matthew</td><td>Brittany</td> So, I want to extract "Brittany" from the above line [CODE]for line in f: match3 = re.search(r'$([a-zA-Z]+)(</td>)',line) if match3: print match3.group(1)[/CODE] But this ain't working. Please help. | |
[CODE]con=L2DatabaseFactory.getInstance().getConnection() rem=con.prepareStatement("DELETE FROM buffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1") rem.setString(1, scheme) rem.setString(2, skill) rem.setString(3, level) try : rem.executeUpdate() except : pass if getBuffCount(scheme) == 0 : HTML = getOptionList(scheme) else : HTML = viewAllSchemeBuffs(scheme,eventParam2,"remove") return HTML if event == "add_buff" : event = eventParam1.split("_") scheme = event[0] … | |
<text> <p><s id="s1"><ng><w pws="yes" id="w1" p="CD">25</w> <w l="woman" pws="yes" id="w4" p="NNP" common="true" headn="yes">Woman</w></ng> <vg tense="past" voice="act" asp="simple" modal="no"><w l="create" pws="yes" id="w10" p="VBD" headv="yes">created</w></vg> <pg><w pws="yes" id="w18" p="IN">for</w></pg> <ng><w vstem="succeed" l="success" pws="yes" id="w22" p="NN" headn="yes">success</w> <w l="barbie" pws="yes" id="w30" p="NN" headn="yes">barbie</w></ng> <ng><enamex type="location"><w l="reynold" pws="yes" id="w37" p="NNP" locname="single">Reynolds</w></enamex> <w l="sep" pws="yes" … | |
Is there a way to read Adobe PDF files with Python? | |
Let's say the website has this code: [url]http://www.hypergurl.com/randomimage.html[/url] What it does is each time you load the page the script generates a random number and loads the appropriate image. Let's just say that the image is an image of that number and this website displays this random number in text … | |
Say I have a list of lists as follows (which I do): [CODE][['Value1', 'Value2', 'Value3'], ['Value1', 'Value2', 'Value3'], ['Value1', 'Value2', 'Value3'], ['Value1', 'Value2', 'Value3']][/CODE] What I want to accomplish is if in any list Value1 & Value2 equal the Value1 & Value2 of any other list, I want to merge … | |
[CODE]Hi all... I'm making a php interface to start, stop and control a program running on a windows pc. At the moment I can start it with [CODE="php"]pclose(popen('start c:\users\server\mtaserver.exe',"r"));[/CODE] and stop it with [CODE="php"]pclose(popen('taskkill /F /IM mtaserver.exe',"r"));[/CODE] both of which use windows tools to operate, they then get killed allowing … | |
[CODE]class Triangle: def __init__(self,x,y,z): self.x = x self.y = y self.z = z def perimeter(self): return self.x + self.y + self.z def area(self): ang = acos(self.y^2 - self.x^2 - self.z^2 / -2 * self.x * self.z) h = sin(ang) * self.x return self.z * h / 2 triangle = Triangle(input("Please … | |
Hello, colleagues, Greetings I'm developing this code but I have problems on the part of a database query look at the full function code in which I have problems other than data base is [CODE]import sqlite3 as lite con = lite.connect('MiBase.sqlite') c = con.cursor() c.execute("""create table inventario (codigo real, producto … | |
This snippet defines a context [icode]autofilename()[/icode] to create an existing temporary file with a new name in python. Unlike the methods in the [icode]tempfile[/icode] module, it only gives a filename which exists within a 'with' block, instead of an open file. This is useful for example when a program needs … | |
Hi All When trying to open a URL with bellow code, it Gives "TypeError: not all arguments converted during string formatting" [CODE=python]import urllib City="%D9%85%D9%87%D8%B1%D8%A7%D9%86" Province="%D8%A7%DB%8C%D9%84%D8%A7%D9%85" myurl = 'http://www.owghat.com/owghat.png.aspx?Province='+'%s'+'&City='+'%s'%(Province, City) #the real address is:http://www.owghat.com/owghat.png.aspx?Province=%D8%A7%DB%8C%D9%84%D8%A7%D9%85&City=%D9%85%D9%87%D8%B1%D8%A7%D9%86 a="e:\\img.png" urllib.urlretrieve(myurl,a)[/CODE] So, what I'm doing wrong? AND Another question: How to encode a utf-8 string(example: مهران) … | |
I'm interested in a generic event system for Python. I've searched the forum for similar topics, and I've searched the web for existing implementations. I haven't found exactly what I'm looking for. I'm familiar with the Observer pattern. However, my implementation and other implementations lack strong support for concurrency and … | |
I have been looking for tutorials for about an hour now for pythin networking and nothing i am finding is helpful. What i need is a python program that will take a computers ip adress and tell me if a specific port is open. Can anyone give me a quick, … | |
Here is Mandelbrot set viewer in Tkinter and modules for shedskining (included compiled modules for windows in the zip file): [CODE]# mandelsh.py def mandel(real, imag, max_iterations=20): '''determines if a point is in the Mandelbrot set based on deciding if, after a maximum allowed number of iterations, the absolute value of … | |
Hello, I'm a student in a summer workshop and i'm trying to make a python table from which people can choose the type , and within a mile radius. It's suppose to be compatible with an Arcgis map. If anyone knows how to make something similar please tell me how … | |
I am working in an older version of Python (2.6, I believe). I cannot update to the latest version because it is not currently compatible with the other program I need the code to run with so, unfortunately, the "decimal" module is not available to me (as far as I … | |
Hello python gurus! I dabble in python casually, and I've just recently begun to use classes. For the most part they've proven very helpful, but this error has me stumped: [CODE]creature.health=creature.health-2*creature.metabolsim/resolution AttributeError: predator instance has no attribute 'metabolsim'[/CODE] Here's the full code of the program (it's designed to run a … | |
Hello, kind citizens of DaniWeb! I beg your assistance in the solution of my problem! I was trying to create a simple audio player using Tkinter and pygame, pygame being the best library that included audio playback I could find (by the way, DO NOT USE SNACK!!). Anyway, I was … | |
I am working with a CSV file with multiple rows, which I need to be able to access individual data elements from a row so I can assign them to variables and send them to the other program I am working with in a loop, going through each individual row. … | |
I'm trying to embed python script in c in windows. [CODE] #include <Python.h> int main(int argc, char *argv[]) { Py_Initialize(); PyRun_SimpleString("from time import time,ctime\n" "print 'Today is',ctime(time())\n"); Py_Finalize(); return 0; } [/CODE] from the python documentation. I'm compiling with Microsoft's lcc. I'm getting following errors. Error c:\lcc\examples\python\pyembed.c 7 undefined reference … | |
this prints all five iterations. cani make it only print the last iteration? [CODE]key1 = [' ','a','b','c','0','1','2','3'] out = '' inpt = raw_input('enter text:') for i in inpt: if i in key1: out = out + key1[key1.index(i)+3] print out[/CODE] | |
I am newbie in Python and given a task from my boss to do this : 1. Grab streaming(real time) data from twitter using PyCurl connection and output in JSON 2. Parsing using NLTK and Regular Expression 3. Save it to database file(MySQL) Note : i took the data from … | |
Hi any idea of how to parse a file like this. The problem that I found reading a line a putting into a list that it does not respect the blanks, I need to parse first 9 positions, then 8 positions then 8 positions, then 7, then 7 then 7 … | |
Hello I need to rename a folder within / inside a ZIP file, preferably without extract it and compress it off-course. How can I do this (only with free help stuff if needed) ? Thanks | |
I'm frustrated by the nature of time.sleep(), which prevents the script from doing anything else during the allotted time period. For example, I have: [CODE]while True: checkSomething() time.sleep(0.1) print 'hello'[/CODE] In this case, "hello" is never printed. I really want to check something every few milliseconds, but I also need … |
The End.