Hi,
I have two files and the content is as follows:
Please only consider the bolded column and the red column. The remaining text is junk and unnecessary. As evident from the two files they are similar in many ways. I am trying to compare the bolded text in file_1 and file_2 (it is not bolded but hope you can make out it is the sam...
I want test a FIX gateway for our company and was wondering if anything in opensource already exists that I can use or perhaps leverage to complete this task.
I am currently looking at QuickFix but I am not sure if it has a client that can be use against any standard FIX gateway.
Also links to any learning material that exist on this...
Many python IDE's will start you with a template like:
print 'hello world'
That's not enough... So here's my skeleton code to get this question started:
My Module Skeleton, Short Version:
#!/usr/bin/env python
"""
Module Docstring
"""
#
## Code goes here.
#
def test():
"""Testing Docstring"""
pass
if __name__=='__main__'...
I have a Django project. Given a url, how can I know which view will be dispatched to handle the request?
...
I have one list that I want to take a slice of, reverse that slice and append each of those items onto the end of another list. The following are the options I have thought of (although if you have others please share), which of these is the most pythonic?
# Option 1
tmp = color[-bits:]
tmp.reverse()
my_list.extend(tmp)
# Option 2
my_...
Can you send a paypal payment with a script? I've been googling for this, but I can't seem to find the answer I want (yes) ;-)
An example of what I am talking about: Lets say I have a site where users share in the profit. Instead of sending each users payment out manually at the end of the month, I would like to automate this with co...
Hi,
I have csv file with following data
val1,val2,val3
1,2,3
22,23,33
So how can I convert data into dict
dict1 = { 'val1': 1, 'val2': 2, 'val3': 3}
dict2 = { 'val1': 22, 'val2': 23, 'val3': 33}
fp = open('file.csv', 'r')
reader = csv.reader(fp)
for row in reader:
????
Thanks
...
I'm attempting to use the python subprocess module to log in to a secure ftp site and then grab a file. However I keep getting hung up on just trying to send the password when it is requested. I so far have the following code:
from subprocess import Popen, PIPE
proc = Popen(['sftp','user@server', 'stop'], stdin=PIPE)
proc.communicate('...
If I have this:
class A:
def callFunction(self, obj):
obj.otherFunction()
class B:
def callFunction(self, obj):
obj.otherFunction()
class C:
def otherFunction(self):
# here I wan't to have acces to the instance of A or B who call me.
...
# in main or other object (not matter where)
a = A()
b = B()...
Hi,
I'm trying to set up thrift in order to incorporate with Cassandra, so when I ran the
setup.py
it out puts this message in command line
running build
running build_py
running build_ext
building 'thrift.protocol.fastbinary' extension
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python26\include -IC:\Pytho
n26\PC -c src/p...
I have two lists which are guaranteed to be the same length. I want to compare the corresponding values in the list (except the first item) and print out the ones which dont match. The way I am doing it is like this
i = len(list1)
if i == 1:
print 'Nothing to compare'
else:
for i in range(i):
if not (i == 0):
...
What are the best libraries for interactive webcharts allowing the user to add data points by clicking? I would like to basically have a graphical input device sitting on the browser.
I think google charts and JFreeChart can do something like this. Wide open license is a plus but this is just for a learning project so not a big deal.
A...
So I'm trying to access this api https://www.clarityaccounting.com/api-docs/ using SUDS. Here is the code that should work:
from suds.client import Client
client = Client('https://www.clarityaccounting.com/api/v1?wsdl')
token = client.service.doLogin('demo', 'demo', 'www.kashoo.com', 'en_US', 300000)
But I get this error:
WebFault: ...
hi all,
I'm currently using the method below to define a multidimensional dictionary in python. Question is... is this the preferred way of defining multidim dicts?
from collections import defaultdict
def site_struct(): return defaultdict(board_struct)
def board_struct(): return defaultdict(user_struct)
def user_struct(): return dict(p...
Hi,
I'm using iPython right now to interactively set up a Twisted network. The script that I run in iPython describes best of what I have to do:
import router, pdb
# creates nodes which encapsulate RandomVector and VectorAdder objects
a = router.LocalNode(router.RandomVector, '/topic/a_c')
b = router.LocalNode(router.RandomVector, '/t...
My problem is quite simple: I have a 400MB file filled with 10,000,000 lines of data. I need to iterate over each line, do something, and remove the line from memory to avoid filling-up too much RAM.
Since my machine has several processor, my initial idea to optimize this process was to create two different processes. One would read the...
I am modifying a python script to make changes en masse to a hand full of switches via telnet:
import getpass
import sys
import telnetlib
HOST = "192.168.1.1"
user = input("Enter your remote account: ")
password = getpass.getpass()
tn = telnetlib.Telnet(HOST)
tn.read_until("User Name: ")
tn.write(user + "\n")
if password:
tn.read...
What is the nicest way to read the output (i.e. via System.out.println) of a Java app which is called from Python with
subprocess.Popen("java MyClass", shell=True)
without writing and reading a file? (Using Jython etc is not a possible solution)
...
This is a very noobish question, so I apologize in advance!
I have two time stamps for start and end of the event. They are stored in as datetime.datetime in UTC. What I need to do is figure out the duration of the event.
I tried subtracting one from the other, but receive error:
Traceback (most recent call last):
02.
File '/base/pyt...
Hi guys,
Writing an app in Python, and been playing with various ORM setups and straight SQL. All of which are ugly as sin.
I have been looking at ZODB as an object store, and it looks a promising alternative.
My question then:
Would you recommend ZODB?
What are your experiences, problems, criticism with ZODB?
particularly with re...