Hello all,
I know how to append date to the end of the file name, but I m not sure how can I later in script put that filename as a link to FTP server.
For instance:
import datetime
now = datetime.datetime.now()
suffix = now.strftime(""%d-%m-%Y, %H:%M"")
filename = 'My history(%s).txt'%suffix
How can I hard code it NOW variable so ...
Hi,
I have a bunch of apps written in Python 2.4. I'd like to port them onto more recent version of the interpreter. Let's say I have no need of syntax features, but I am very concerned about performance. So which of the upper python versions is the fastest (the most optimized) - 2.4 or 2.5 or 2.6 or 2.7 ?
Performance comparison artic...
Hi Everyones,
I'm trying to use this library : pastebin.com/xgPXpGtw (an example of use: pastebin.com/fNFAW3Fh)
I have some issues since I dont want to split in an array all the byte as he does.
My test script looks like this:
import random
from random import *
def onerand(packet):
pack = packet[:]
byte = str(chr(choice(rang...
I have a dataset consisting of date-value pairs. I want to plot them in a bar graph with the specific dates in the x-axis.
My problem is that matplotlib distributes the xticks over the entire date range; and also plots the data using points.
The dates are all datetime objects. Here's a sample of the dataset:
data = [(DT.datetime.strpt...
A person (a senior citizen who is learning the very basics of computers) asked me to make a program that will save him LOTS of time with a grunt work type of task. I made the script in Python, it's simple, command line, takes input from the user and saves the output to a file and that's it.
My first question is related to the output of ...
I am trying to install the aggdraw python library to create high quality graphics but I keep getting this error:
agg22/include/agg_array.h: In member function `agg::int8u*
What is the workaround for this? How can I install it?
...
I am looking for (list of) projects that use py.test.
I am new to testing, and want to use py.test. I need examples from projects, so i can use py.test extensively. The documentation is good for py.test but is too fragmented to get a good grasp. I have a vague idea of how it works. I saw the py.test video(3hrs) from pycon. But need some...
A webpage has a product code I need to retrive, and it is in the following HTML section:
<table...>
<tr>
<td>
<font size="2">Product Code#</font>
<br>
<font size="1">2342343</font>
</td>
</tr>
</table>
So I guess the best way to do this would be first to reference the html element with the text value 'Product Code#', and then re...
Suppose that I am looping over a iterable and would like to take some action if the iterator is empty. The two best ways that I can think of to do this are
for i in iterable:
# do_something
if not iterable:
# do_something_else
and
empty = True
for i in iterable:
empty = False
# do_something
if empty:
# do_someth...
can i connect two objects that are in different classes ?
lets say i want button1's clicked() signal to clear line2
class A(QGroupBox):
def __init__(self, parent=None):
super(A, self).__init__(parent)
self.button1= QPushButton('bt1')
self.button1.show()
class B(QGroupBox):
def __init__(self, parent=Non...
A url looks like:
http://www.example.com/cgi-bin/blahblah?&PC=abd23423&uy=020
I need to extract the value: abc23423
I tried this regex but its not working:
rx = re.compile(r'PC=(\w*)&uy=')
I then I did:
pc = rx.search(url).groups()
but I get an error:
attribute error: nonetype object has no attribute groups.
...
Say I reference an element inside of a table in a HTML page like this:
someEl = soup.findAll(text = "some text")
I know for sure this element is embedded inside a table, is there a way to find the parent table without having to call .parent so many times?
<table...>
..
..
<tr>....<td><center><font..><b>some text</b></font></center><...
I have a numpy array of pixel data that I want to draw at interactive speeds in pygtk. Is there some simple, fast way to get my data onto the screen?
...
I want to send it and forget it. The http rest service call I'm making takes a few seconds to respond. The goal is to avoid waiting those few seconds before more code can execute.
I'd rather not use python threads
I'll use twisted async calls if I must and ignore the response.
...
Can seem to find a substring function in python.
Say I want to output the first 100 characters in a string, how can I do this?
I want to do it safely also, meaing if the string is 50 characters it shouldn't fail.
...
Hi
I have a wxpython app designed using XRC which has a multiline textctrl inside nested boxlayouts.
I'm adding some text(retrieved from the web) to the text control using SetValue(), inside the longtask method from a separate thread using the following code
thread.start_new_thread(self.longtask, ())
The app runs fine the first c...
Hi All,
i'm a newbie in python , and trying to install libgmail ..
this is what i get :
C:\libgmail-0.1.11>setup.py
Traceback (most recent call last):
File "C:\libgmail-0.1.11\setup.py", line 7, in <module>
import libgmail
File "C:\libgmail-0.1.11\libgmail.py", line 96
exec data in {'__builtins__': None}, {'D': lambda x: r...
I've got an exam coming up soon. I've been looking through the past paper, this question keeps bugging me. I can't seem to find what the bug in the program could be because I'm quite new to all this. Can anyone help me out?
The following program contains a bug. Determine what kind of problem the program exhibits, and show how it can be...
So I have this page:
http://hub.iis.sinica.edu.tw/cytoHubba/
Apparently it's all kinds of messed up, as it gets decoded properly but when I try to save it in postgres I get:
DatabaseError: invalid byte sequence for encoding "UTF8": 0xedbdbf
The database clams up after that and refuses to do anything without a rollback, which will be...
Hi
I wonder if you can help. I want to write a script in python that will run a query on google and output the results of the query as
Thanks
adaptive
...