15,185 Topics

Member Avatar for
Member Avatar for stefh

Hi there, my name is Stéphane, i'm french and a beginner with Python... I've registered on a french forum about Python to ask a question regarding an issue i have with a code, but it seems the members of this forum are not active. I paste the message i posted …

Member Avatar for stefh
0
657
Member Avatar for Vertana

I've been racking my brain over this for a few days now. I'm attempting to write a program in Python 3.1 / PyQt 4.7.5 that will open a Powerpoint, go through every shape on every slide, determine if it is a picture and then save that picture to the specified …

Member Avatar for Vertana
0
1K
Member Avatar for Urban48

hello! I'm developing a software to monitor communication to different locations. the principle is simple: send ping every second and display the results in real time (ms delay, packet loss etc) It's also important to mention that I'm running the software from Linux, so in order to ping from my …

0
113
Member Avatar for Gribouillis

This snippet defines a function [icode]a2bits[/icode] which converts a characters string to a string of 0's and 1's showing its bitwise representation.

Member Avatar for Gribouillis
0
2K
Member Avatar for Thropian

I have a string such as [CODE]"this is a really long string that is completely pointless. But hey who cares![/CODE] and I was wondering if there was a way to cut the first X characters off and return the res of the string

Member Avatar for TrustyTony
0
116
Member Avatar for Krstevski

Hello friends, I have a small problem with creating XML documents. After creating the XML when I try to get a XML document as string using .toxml() or .toprettyxml() functions i got escaped string. [CODE=python] >>> from xml.dom.minidom import Document >>> html = '<a href="http://www.google.com/">Google</a>' >>> doc = Document() >>> …

Member Avatar for Gribouillis
0
445
Member Avatar for Greyhelm

I am trying to understand using an SQLite database in Python and can grasp running queries, but would like to understand how to populate Python variables from SQLite fields. Here is my sample Python code: [CODE]import sqlite3 id = 0 name = "" occupation = "" location = "" connection …

Member Avatar for richieking
0
4K
Member Avatar for neroth

A bit of background: I've been working on a python script to do some calculations on a land use model. Basically, I take amount of space developed in the future and pull out a table that has the amount of space by geographic area within the larger area. I load …

Member Avatar for neroth
0
308
Member Avatar for BirdaoGwra

Hi, Right now I have this. And I could not understand how to sort it out: [CODE]def onView(self): img = wx.EmptyImage(240,240) filepath = self.filedlg.GetPath() img = wx.Image(filepath, wx.BITMAP_TYPE_ANY) img = img.Scale(240,240) picture = ogl.BitmapShape() picture.SetBitmap(wx.BitmapFromImage(img)) self.canvas.AddShape(picture)[/CODE] I want to load an image with fileDialog into a wx ogl canvas. Thanks …

Member Avatar for BirdaoGwra
0
120
Member Avatar for acehigher

Hello, I think this is a pretty simple problem but I just don't know where to start. I have a text file: 1 00:00:34,000 --> 00:00:36,135 Thank you, Detective. 2 00:00:42,714 --> 00:00:45,794 - Any change? - Nothing since you left. 3 00:00:52,988 --> 00:00:55,585 She seems to be looking …

Member Avatar for Gribouillis
0
102
Member Avatar for python01

Hi all, I was just wondering if anybody could point me in the right direction regarding a program that need to be able to track the cursor and draw it's path on the screen. I was thinking about Tkinter, but is there another option?

0
51
Member Avatar for rx21825

Hi. I am a python newbie seeking some help in working with a file containing rows and columns. I have a file, that ideally contains an equal number of rows and columns. The first row is a tab separated header row and the first column is a label row. The …

Member Avatar for rx21825
0
204
Member Avatar for Thropian

I made a little python code that makes a ball bounce around the screen. Every time you left click it makes another ball. when you right click it clears the screen but you can't spawn more balls afterward... any help (python, tkinter) [CODE]from Tkinter import * import time import base_translate …

Member Avatar for Thropian
0
1K
Member Avatar for BirdaoGwra

Hi, It is my code: [CODE]mylist = [['fiss','giss'], ['e','h'], ['d','u'], ['c','t'], ['b','o'], ['a','z']] for alist in mylist: g = ' '.join(alist) print g f = open("write.txt", "w") f.write(g) f.close()[/CODE] How will I write all the words in the txt file. it is only writing the last line of the file. …

Member Avatar for Tommymac501
0
136
Member Avatar for tcl76

hi, is there a way to convert from string to long? for eg: i want to concatenate all the arrays into data and make it same type (long) as data1. [CODE] a='0x' array0 = '00000018000004000000000000000000' array1 = '00000000000000000000000000000000' array2 = 'fe000000000000000000000000000000' array3 = '00000000000000000000000000ffffff' data = a+array0+array1+array2+array3 print data print …

Member Avatar for Gribouillis
0
5K
Member Avatar for tcl76

hi, i have a script that converts hex to bin and bin to hex back. however, when converting back to hex the leading 0s are truncated. how to maintain the leading 0s? i'm using Python 2.5 and Win XP. tq [CODE] import binascii import string def byte_to_binary(n): return ''.join(str((n & …

Member Avatar for TrustyTony
0
3K
Member Avatar for debasishgang7

hey all, i'm trying to get all content of a webpage using python and trying to put them all into a file. Here is my code: [CODE]import urllib data = urllib.urlopen('http://www.site.net/index.html').read() #print data //if i ignore the rest part of this code the code is just working awesome...its printing the …

Member Avatar for richieking
0
139
Member Avatar for kuchi

Apache is running in UNIX box, and we have configured folder path in config file and we are accessing python code from that folder. In the python code, we have two methods new_page() and access_form_elements(), new_page() -- print new HTML page with two form elements and method=POST and action=same .py …

0
80
Member Avatar for aldusforte

Hi all. I am new as can be to programming. I always heard a good way to learn to write was to find a project that I am interested in and start from there. So my ideal goal is to write a script that cleans up my downloads folder, ie …

Member Avatar for aldusforte
0
372
Member Avatar for Tommymac501

I am trying to replace a fixed field name in an XML file with data. I know that I could do it the proper way using XML tools, but, this is a standard templae file that only needs one item replaced. It seems simpler to just hack a replacment. [CODE] …

Member Avatar for woooee
0
80
Member Avatar for yeleek

I have two lists which contain titles and links to interesting pages (trying to write a scraper). Where I'm falling down is on the actual printing. [CODE]for i in var1: print i for a in var2: print a[/CODE] Prints all of list 1 and then all of list 2. If …

Member Avatar for yeleek
0
100
Member Avatar for rssk

hi all....... I m running a program in windows like this import os os.system('snmpwalk -v2c -c ar441c 192.168.1.10 .1.3.6.1.4.1.18489.1.2.1.1') when i run this i m getting error like [B]SNMPWALK IS NOT RECOGNISED AS A INTERNAL AND EXTERNAL COMMAND,OPERABLE PROGRAM OR BATCH FILE[/B] so anyone can plz help me........ thanks in …

Member Avatar for rssk
0
4K
Member Avatar for zizuno

I have code the goes to a page and downloads information on its update. Every once in a while it errors out with [code] url2z = url2z.read() File "/usr/lib/python3.1/http/client.py", line 502, in read s = self._safe_read(self.length) File "/usr/lib/python3.1/http/client.py", line 594, in _safe_read raise IncompleteRead(b''.join(s), amt) http.client.IncompleteRead: IncompleteRead(15928 bytes read, 37182 …

Member Avatar for TrustyTony
0
344
Member Avatar for Parth tank
Member Avatar for joeywheels

Hi everyone! New here and to Python. I'm having trouble with my break statement executing and cannot figure out why. I'm learning to write to files and want the loop to break if the user hits enter. It's not working for some reason. I've even tried to get fancy (in …

Member Avatar for joeywheels
0
106
Member Avatar for kikuolen

I have to make generetor and ouput must be all combinations.And they are written to .txt file and then user input search from that file. Anyone can help me to wrote that program?

Member Avatar for TrustyTony
0
42
Member Avatar for wilko1995

Hey, does anyone think they could explain how this code works? [CODE]def hanoi(n, a='A', b='B', c='C'): """ move n discs from a to c using b as middle """ if n == 0: return hanoi(n-1, a, c, b) print a, '->', c hanoi(n-1, b, a, c) hanoi(3) [/CODE]

Member Avatar for TrustyTony
0
113
Member Avatar for xunilxunil

Hello. First of all I am a newcomer to programming languages world and of course very new to Python. In my job, we are using Linux systems. Time to time I need to check some command and script outputs on the terminal. So, I wanted to code a small application …

Member Avatar for xunilxunil
0
303
Member Avatar for novice20

Hi, I get the log messages 'twice' on the console and only once in the log file. Can any one tell me the reason for this duplication on console? here is how I have set the logger: [ICODE]import logging #--set up logging to file logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', datefmt='%Y-%m-%d …

Member Avatar for novice20
0
101
Member Avatar for computerstudent

I'm trying to put together a code that will basically take a user input string and reprint every 3rd character. i.e. if a user inputs "Superman" it should be reprinted like "S e a" I'm sure this is Uber-simple to you but I'm just starting out, whether it is efficient …

Member Avatar for TrustyTony
0
154

The End.