Okay. I have completed my first python program.It has around 1000 lines of code.
During development I placed plenty of print statements before running a command using os.system()
say something like,
print "running command",cmd
os.system(cmd)
Now I have completed the program. I thought about commenting them but redirecting all these un...
i am using python 2.5.2. The following code not working.
def findValue(self, text, findText):
index = text.find(findText)
print index
Although the findText is present in text, but it still returns None.
I have printed the values of text and findText and they are present.
Edit: I have fixed the issue.
The problem was i am...
you can load geo-info via two way below:
var g = new GGeoXml("http://zjm1126.3322.org/mymedia/b.kml");
map.addOverlay(g);
or
var g = new GGeoXml("http://tagzania.com/rss/user/blogwatcher/7wonders%2Bnew/");
map.addOverlay(g);
if i want to saving the features(user made on google map,line and point) ,i have to make
a kml or make a ...
I have FigureCanvasWxAgg instance with a figure displayed on a frame. If user clicks on the canvas another frame with a new FigureCanvasWxAgg containing the same figure will be shown. By now closing the new frame can result in destroying the C++ part of the figure so that it won't be available for the first frame.
How can I save the fi...
Having a hard time fixing this or finding any good hints about it.
I'm trying to loop over one file, modify each line slightly, and then loop over a different file. If the line in the second file starts with the line from the first then the following line in the second file should be written to a third file.
with open('ids.txt', 'rU') ...
Hello,
I have a problem.
I use Apache with mod_wsgi and webpy, and when i send a file on http, a lot packets are lost.
This is my code :
web.header('Content-Type','video/x-flv')
web.header('Content-length',sizeFile)
f = file(FILE_PATH, 'rb')
while True:
buffer = f.read(4*1024)
if buffer :
yield buffer
...
This doesn't need to be a real time solution, but are there some log files or system messages that could be read to identify periods of time where someone was connected via RDP to a Windows 7 machine?
I'm building a watchdog script for a computer which will be deployed in a remote place and would like to add this metric to a daily statu...
How can I check with pysvn if a working copy artifact would actually be updated? Is this info readyly available by some method. Or do I have to compare the working copy and repository revision numbers myself?
...
hi, i have two models:
class Project(models.Model):
categories = models.ManyToManyField(Category)
class Category(models.Model):
name = models.CharField()
now, i make some queryset:
query = Project.objects.filter(id__in=[1,2,3,4])
and i like to get list of all distinct categories in this queryset with count of projects with refer...
I'm trying to generate a table of contents from a block of HTML (not a complete file - just content) based on its <h2> and <h3> tags.
My plan so far was to:
Extract a list of headers using beautifulsoup
Use a regex on the content to place anchor links before/inside the header tags (so the user can click on the table of contents) -- Th...
Hi
I am looking for a way to remove a sublist from a list.
something like this:
a=range(1,10)
a.remove([2,3,7])
print a
a=[1,4,5,6,8,9]
...
In my Python script which uses Curses, I have a subwin to which some text is assigned. Because the text length may be longer than the window size, the text should be scrollable.
It doesn't seem that there is any CSS-"overflow" like attribute for Curses windows. The Python/Curses docs are also rather cryptic on this aspect.
Does anybody...
Bit of a beginner question here:
Say I have a block of xml:
<root>
<district>
<house><room><door/><room></house>
</district>
<district>
<street>
<house>and so on</house>
</street>
etc.
With ElementTree I can do:
houses=doc.findall(".//house")
to select all the house nodes, regardless of their parent. What I want to do...
Can I define a function which, when called, inserts new locals into the caller's scope? I have a feeling that passing the caller's locals() into the function might work, but is there a way to do what I want without having to do this?
...
Emacs uses an older version of python(2.3) i have for the default python mode, is there a way for me to tell emacs to use the newer version that i have in my home directory?
btw I'm using a red hat distro and dont have root privileges.
...
Hey guys, I'm writing a script that is retrieving information from places.sqlite (history) and realized that it store the time in PRTime format. Is there a method available in python which could convert this date time or do i have to make it myself?
...
I know Python (and a bunch of other languages) and I think it might be nice to learn Perl, even if it seems that most of the people is doing it the other way around.
My main concern is not about the language itself (I think that part is always easy), but about learning the Perlish (as contrasted with Pythonic) way of doing things; becau...
Hi,
the following code comes from the matplotlib gallery:
#!/usr/bin/env python
from pylab import *
x = array([10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5])
y = array([8.04, 6.95, 7.58, 8.81, 8.33, 9.96, 7.24, 4.26, 10.84, 4.82, 5.68])
I am new to python, and would like to change the content of x and y from an input file. I have two short ...
In one of my Django templates, I have a chunk of HTML which repeats at several places in the page. Is there a way I could use another template for this chunk alone and "instantiate" the template where required?
...
I'd like to replace an app's current (badly busted and crufty) cURL-based (cURL command-line based!) SOAP client with suds or soap.py. Trouble is, we have to contact an MS CRM service, and therefore must use NTLM. For a variety of reasons the NTLM proxy is a bit of a pain to use, so I'm looking into python-ntlm to provide that support.
...