//parses some string into that format.
datetime1 = datetime.strptime(somestring, "%Y-%m-%dT%H:%M:%S")
//gets the seconds from the above date.
timestamp1 = time.mktime(datetime1.timetuple())
//adds milliseconds to the above seconds.
timeInMillis = int(timestamp1) * 1000
How do I (at any point in that code) turn the date into UTC forma...
I'm testing subprocesses pipelines with python. I'm aware that I can do what the programs below do in python directly, but that's not the point. I just want to test the pipeline so I know how to use it.
My system is Linux Ubuntu 9.04 with default python 2.6.
I started with this documentation example.
from subprocess import Popen, PIPE...
I'm writing a GUI application that regularly retrieves data through a web connection. Since this retrieval takes a while, this causes the UI to be unresponsive during the retrieval process (it cannot be split into smaller parts). This is why I'd like to outsource the web connection to a separate worker thread.
[Yes, I know, now I have t...
Hello,
I am working in a limited environment developing a python script.
My issue is I must be able to accomplish datetime addition and subtractions.
For example I get the following string:
"09/10/20,09:59:47-16"
Which is formatted as year/month/day,hour:minute:second-ms.
How would I go about adding 30 seconds to this number in P...
I'm trying to add multithreading to a Python app, and thus started with some toy examples :
import threading
def myfunc(arg1, arg2):
print 'In thread'
print 'args are', arg1, arg2
thread = threading.Thread(target=myfunc, args=('asdf', 'jkle'))
thread.start()
thread.join()
This works beautifully, but as soon as I try to st...
I am having a very tough time achieving this one seemingly very simple goal...
I have to gather the value of a single registry key on several machines for the sake of auditing whether the machines scanned need to be patched with newer versions of software. I am only permitted to use python 3 as per our company policy (which is on drugs...
At some point I need to display a "disabled" (greyed out by disabled="disabled" attribute) input of type "select". As specified in the standard (xhtml and html4), inputs of type "select" can not have the "readonly" attribute. Note that this is for presentation purposes only, the actual value must end up in the POST. So here is what I do ...
data = [unicode('č', "cp1250"),
unicode('d', "cp1250"),
unicode('a', "cp1250")]
data.sort(key=unicode.lower)
for x in range(0,len(data)):
print data[x].encode("cp1250")
and I get:
a
d
č
It should be:
a
č
d
Slovenia Alphabet goes like: a b c č d e f g.....
I'm using WIN XP(Active code page: 852 - Slovenia...
I currently have a number of Python scripts that help prep a staging area for testing. One thing that the scripts do not handle is executing DTS packages on MS SQL Server. Is there a way to execute these packages using Python?
...
Possible Duplicate:
How do I get started in game development?
I am an amateur programmer trying to make my first game. I've been trying to create an 'old-school' first person dungeon crawler in the spirit of Dungeon Master, Ultima and all the early AD&D games like Curse of the Azure Bonds. I loved all of those games! I even look...
hello, I want to filter repeated elements in my list
for instance
foo = ['a','b','c','a','b','d','a','d']
I am only interested with:
['a','b','c','d']
What would be the efficient way to do achieve this ?
Cheers
...
I'm starting to experiment with CouchDB because it looks like the perfect solution for certain problems we have. Given that all work will be on a brand new project with no legacy dependencies, which client library would you suggest that I use, and why?
This would be easier if there was any overlap on the OSes we use. FreeBSD only has ...
Hi,
Can someone please suggest to me any python library to plot graph like
http://www.google.com/finance/images/retail%5Fq%5Findex.png
Thank you.
...
I'm using Python (minidom) to parse an XML file that prints a hierarchical structure that looks something like this (indentation is used here to show the significant hierarchical relationship):
My Document
Overview
Basic Features
About This Software
Platforms Supported
Instead, the program iterates multiple times over ...
Every now and then I receive a Word Document that I have to display as a web page. I'm currently using Django's flatpages to achieve this by grabbing the html content generated by MS Word. The generated html is quite messy. Is there a better way that can generate very simple html to solve this issue using Python?
...
I am trying to read a file from a server using ssh from python. I am using paramiko to connect. I can connect to the server and run a command like 'cat filename' and get the data back from the server but some files I am trying to read are around 1 GB or more in size.
How can I read the file on the server line by line using python?
Addi...
What would be the best library for multithreaded harvesting/downloading with multiple proxy support? I've looked at Tkinter, it looks good but there are so many, does anyone have a specific recommendation? Many thanks!
...
I have to make a rudimentary FSM in a class, and am writing it in Python. The assignment requires we read the transitions for the machine from a text file. So for example, a FSM with 3 states, each of which have 2 possible transitions, with possible inputs 'a' and 'b', wolud have a text file that looks like this:
2 # first li...
I'm encoding challenged, so this is probably simple, but I'm stuck.
I'm trying to parse an XML file emailed to the App Engine's new receive mail functionality. First, I just pasted the XML into the body of the message, and it parsed fine with CElementTree. Then I changed to using an attachment, and parsing it with CElementTree produces ...
How can you replace the match with the given replacement recursively in a given directory and its subdirectories?
Pseudo-code
import os
import re
from os.path import walk
for root, dirs, files in os.walk("/home/noa/Desktop/codes"):
for name in dirs:
re.search("dbname=noa user=noa", "dbname=masi user=masi")
...