14,951 Topics

Member Avatar for
Member Avatar for Brutus2000

Hi, I have some problems just to write a simple string output to some txt.file. That is my test code: [CODE]test = open('Test.txt', 'w') test.write("Teststring") test.close()[/CODE] I use Python 2.6.5 and PyScripter If I direcly enter the code in the IDLE SHELL, sometimes it works, sometimes only the file is …

Member Avatar for d5e5
0
97
Member Avatar for PaulStat

Hi Folks, I have a set of csv files that I open and read the contents of a row into a DictReader, this works fine 99% of the time, but occasionally one of the fields in a record has an extra new line character. For example here's the format of …

Member Avatar for d5e5
0
2K
Member Avatar for Ashena

I have a file that has a repeated number of blocks of different sizes as in below: ID: 2 Time: 76 Op: GET Domain: facebook.com LPath: /common/css/common.css Referer: [url]http://google.com[/url] User-Agent: Mozilla/4.0 ID: 3 Op: GET Domain: rfi.fr LPath: /common/css/common.css Referer: [url]http://yahoo.com[/url] For each block, I want to print only the …

Member Avatar for TrustyTony
0
13K
Member Avatar for python01

Hi all, does anyone know if there is already a module or something floating about that would let me create apps for my itouch all responses are appreciated, python01

0
51
Member Avatar for KrazyKitsune

If we have a number -2.0, -1.0, 0.0, 1.0, 2.0, 3.0 etc, can we remove the floats with minimal usage of if statements? I know that we can round down, but it wouldn't work in case we get a float like 1.2435532, or something similar. Note: Note that the list …

Member Avatar for Gribouillis
0
48
Member Avatar for novice20

I want some insight into /etc/apt/preferences and /etc/apt/sources.list file on debian

Member Avatar for Gribouillis
0
42
Member Avatar for Wumbate

I'm trying to make a Python script that makes a HTTP POST with some headers, and with a file as the body. I've found all sorts of documentation online about making a HTTP POST with headers, but can't figure out how to make the POST with a file as a …

0
44
Member Avatar for knan

I have 2 lists X=['a'] Y=['b','c','d','e','f'] I need to make a new list Z such that, Z = ['ab','ac','ad','ae','af'] I know this uses simple concatenation. I tried several times but without success. I am a beginner so please help me with the code. Thanks in advance.

Member Avatar for Gribouillis
0
112
Member Avatar for Ultralisk

Hi I've been pulling my hair out over this program. It is uses a Class for creating objects to be used in an ordering tracking system. I'm having problems calling the objects and implementing them. I'm trying to follow a structure along these lines When an order is created payment …

Member Avatar for Ultralisk
0
155
Member Avatar for sss33

Convert the following code to a for loop while (b < a) : b = b + 1 print b

Member Avatar for snippsat
0
44
Member Avatar for nk28

Hello all, I am in need of a simple plotting library in python that can work according to the given specification. I have around a million entries of data which I need to represent on a graph. The problem is that most of the libraries need a list for plotting …

Member Avatar for Gribouillis
0
144
Member Avatar for python01

whenever i want to use urllib or urllib2, i get this error IOError: [Errno socket error] (10035, 'The socket operation could not complete without blocking') i have tried googling it yet i havent found anything helpful any help is apreciated, python 01

Member Avatar for python01
0
163
Member Avatar for sjones1025

Hi there, I am fairly new to Python and have installed Python 2.6 and IronPython 2.6 for .net 4.. I am attempting to write my first script and can't get past my first line of code, which is just import clr I get the error ImportError: No module named clr …

0
45
Member Avatar for PaulStat

I'm trying to use pythons logging.handlers.SMTPHandler with a configuration file (so that I don't have to have passwords etc. inside of the script) Now the guide I'm following is [URL="http://docs.python.org/library/logging.html#configuration-file-format"]here[/URL], now the RotatingFileHandler is working, but I never receive an email, or an error for the SMTPHandler. Anyway here's the …

Member Avatar for Gribouillis
0
1K
Member Avatar for dustbunny000
Member Avatar for Nick Evan
-1
85
Member Avatar for python01

hi all, im fairly new to python and am struggling to find out how to read javascript values from a site. Help is much appreciated. thanks, Python01

Member Avatar for python01
0
174
Member Avatar for dustbunny000

Say I have two lists: list1=[a,b,c,d,e,f,a,b,c] list2=[a,c,d] How could I compare list1 and list2 such that I would get an output like: list3=[match,-,match,match,-,-,-,-,-] So that it goes in order Here's my code: [CODE]h=[] for i in range(len(change2)): for j in range(len(atom)): if atom[j]==atom[i]: h.append("H") else: h.append("-") print h[/CODE] Both change2 …

Member Avatar for Gribouillis
0
112
Member Avatar for dustbunny000
Member Avatar for Gribouillis
0
226
Member Avatar for Megabyte89

Sorry if this is in the wrong thread, I haven't been here in a long time. Hi, I'm having a hard time in trying to position my wx.StaticText and wx.TextCtrl so that it's not stuck at the very top and very left. Life so [URL="http://i154.photobucket.com/albums/s274/Tye-Ann/daniweb.png"]Screenshot Here[/URL] Here is the code …

Member Avatar for Megabyte89
0
963
Member Avatar for G-Do

Here's something of mine that might actually be useful: a Python implementation of the K-means clustering algorithm. I wrote something similar last year in Java for a school project, and decided to rewrite it in Python this summer for practice. The purpose of the algorithm is to discover internal structure …

Member Avatar for woooee
2
1K
Member Avatar for jeffrey.pry

Hey, I am trying to use multiprocessing via the Process module. I run two processes in unison and for some reason python or the os kills my process after roughly 50 seconds or during long processes (~3 min). I just get the following output: File 3 of 8 2010-10-11 13:28:09.090816: …

Member Avatar for woooee
0
163
Member Avatar for arareyna

Hi everyone.. I'm new to python, the more to matplotlib :( and I am hoping that I can get help from this community... :) I have a .csv file, first column is a time stamp with format HH:MM:SS, next 8 columns are values of different parameters. I want to plot …

Member Avatar for Gribouillis
0
3K
Member Avatar for novice20

while trying to install net-snmp-5.6, i get following error [B]gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.5 -c netsnmp/client_intf.c -o build/temp.linux-i686-2.5/netsnmp/client_intf.o netsnmp/client_intf.c:1:20: error: Python.h: No such file or directory In file included from /usr/local/include/net-snmp/net-snmp-includes.h:69, from netsnmp/client_intf.c:4:[/B] my debian system has python2.5.2 where can I find Python.h header …

Member Avatar for Gribouillis
0
550
Member Avatar for dustbunny000

I am having problems with tuples. I have a list of tuples that have (x,y,z) coordinates. Each coordinate is a float. How can I calculate the distance between two coordinates? Can you do this with tuples? [CODE]coord=[] for line in CN_list: x=line[30:39] y=line[38:47] z=line[46:55] coord.append((float(x),float(y), float(z)))[/CODE]

Member Avatar for griswolf
0
94
Member Avatar for lewashby

Minimal Server [CODE]import socket s = socket.socket() host = socket.gethostname() port = 1234 s.bind((host, port)) s.listen(5) while True: c, addr = s.accept() print 'Got connection from', addr c.send('Thank you for connecting') c.close()[/CODE] Minimal Client [CODE]import socket s = socket.socket() host = socket.gethostname() port = 1234 s.connect((hos[/CODE]t, port)) print s.recv(1024) These …

Member Avatar for Gribouillis
0
122
Member Avatar for Archenemie

Im making a custom text editing program as a mini project and id like a little advice on the way to go about it. Within wx python I could use a rich text box or a textctrl box I believe. The type of things I am going to need my …

0
65
Member Avatar for P!th

I heard this forum was a wonderful place to ask programming related questions. So here I am, I'd like to know if anybody has a solution to a problem I'm having. I'm currently planning on creating a game on Python, and I've decided to make use of a joystick in …

Member Avatar for P!th
0
232
Member Avatar for Abhishek2805
Member Avatar for cghtkh
0
55
Member Avatar for softbrianes

[CODE]def egcd(a,b): u, u1 = 1, 0 v, v1 = 0, 1 while b: q = a // b u, u1 = u1, u - q * u1 v, v1 = v1, v - q * v1 a, b = b, a - q * b return u, v, a …

Member Avatar for Schol-R-LEA
0
102
Member Avatar for pacers10

The problem is to get a random list of numbers from a list This is what i have so far.[CODE]import random def numberShuffle(myList): sList = [] nNumbers = len(myList) for i in numbers: j = random.randint(i) return (sList) [/CODE]

Member Avatar for TrustyTony
0
61

The End.