15,406 Topics

Member Avatar for
Member Avatar for Cyproz

Ok so i need to make a program that you put in an email address and it checks for the @ symbol and then makes sure its not the first digit or the last digit. Now i know that there is " like s.islower( for lowercase) and s.isupper but i …

Member Avatar for vegaseat
0
120
Member Avatar for Stev0

Hello all, I'm an information security professional who's decided to teach myself python, so for my first project I wanted to make something that I could actually find useful, so I've developed a small program for log file parsing and amazingly after some trial and error, it works :) However …

Member Avatar for Stev0
0
143
Member Avatar for newharvar

hi,everybody I am study ctypes,and got a big trouble,I googled lots a pages but get no usefull info. i want to know how to get the interface from winxp by using ctypes, for example: I want to use ActiveDesktop 's interface by using ctypes,but i don't know how to do,can …

Member Avatar for Tech B
0
192
Member Avatar for saurav4ever

i have updated my centos python2.4.3 to python 5.1 i followed the following process: which python /usr/bin/python python -V Python 2.4.3 cd /usr/local/src wget [url]http://www.python.org/ftp/python/2.5.1/Python-2.5.1.tgz[/url] tar xvzf Python-2.5.1.tgz make make install ls -l /usr/local/bin/python mv /usr/bin/python /usr/bin/python-orig ln -s /usr/local/bin/python /usr/bin/python ls -l /usr/bin/python -> /usr/local/bin/python python -V Python 2.5.1 …

Member Avatar for Gribouillis
0
323
Member Avatar for Kruptein

I have created a script to encrypt and decrypt a text message based on the bifid cipher([url=http://en.wikipedia.org/wiki/Bifid_cipher]wiki about bifid[/url]) everything works fine [B]IF[/B] the text message does only contain letters. How can I integrate the ability off spaces etc... the best way? by adding them to my alphabet might solve …

Member Avatar for Kruptein
0
2K
Member Avatar for leftyb

hi im am using this code(Python) to get the n -grams for a word : [CODE] import string; import sys; # N N = 6; # file f_in = open("test.txt", 'r'); ln = f_in.read() wlen = len(ln); i = 0; while (i < wlen - N + 1 ): for …

Member Avatar for KNatali
0
2K
Member Avatar for octopusgrabbus

I've read other posts in this form, but still do not know why I get this error: [CODE] File "/home/amr/bin/mysql_lib.py", line 196, in createNewCsRowSQL db_date + ");" TypeError: cannot concatenate 'str' and 'long' objects [/CODE] from this code [CODE] sql_cmd = \ "INSERT INTO customer_synch " + \ "VALUES ( …

Member Avatar for octopusgrabbus
0
340
Member Avatar for tzushky

Hello hello, This post is half related to Python because it is about its automatic documentation generation. I have been playing with Doxygen for a while in C, it was adapted to Python in a second evolution stage a while ago. However after reading a lot of small examples, and …

0
87
Member Avatar for heValbo

Hi! I’m going to explain to you in details of what I want to achieve. I have 2 programs about dictionaries. The code for program 1 is here: [CODE]import re words = {'i':'jeg','am':'er','happy':'glad'} text = "I am happy.".split() translation = [] for word in text: word_mod = re.sub('[^a-z0-9]', '', word.lower()) …

Member Avatar for heValbo
0
103
Member Avatar for vextorspace

I have a (rather large) program that does CAD work written with wxPython and OpenGL. The problem I'm having is that the memory use continually grows as it is used. None of my objects seem to get deleted. Now in order to perform a hit test, I need a dictionary …

Member Avatar for Gribouillis
0
107
Member Avatar for kartikwin

Hello, I am a newbie with Python and used a gheat application ([url]http://code.google.com/p/gheat/[/url]) to display intensity on the US map using a sample input file (points.txt). Currently there is a example.html page that came with the gheat package. I am trying to figure out how to understand the connection between …

0
45
Member Avatar for baki100

Okay i have created a wxPython application and converted it into an windows executable programme using py2exe. The app works perfectly but every time i run the exe the console window appears with the gui. Is there anyway to get rid of the console because the app has to run …

Member Avatar for baki100
0
984
Member Avatar for mattj63

I'm trying to create a csv file from a list of dictionary items where each dictionary in the list has the same keys. I want the csv file to have the keys in the first column and the remaining columns will have the values for each dictionary in the list …

Member Avatar for mattj63
0
1K
Member Avatar for AnnetteM

Hello, I would like to reshape and then transpose data that I import from a file. I downloaded the 'numarray' to access the shape and transpose functions since I am using python version 2.5. This is the pdf I'm using: [url]http://stsdas.stsci.edu/numarray/numarray-1.5.pdf[/url] The data is one long column (length=455), I will …

Member Avatar for AnnetteM
0
607
Member Avatar for pyprog

If I have a string "knockknock", and use the string method replace [CODE]s = "knockknock" s = s.replace("knock", "bam") s "bambam"[/CODE] it replaces both occurences of the substring at once. Is it possible to replace each substring individually as in ("bamknock", "knockbam")?

Member Avatar for vegaseat
0
103
Member Avatar for toll_booth

[CODE] def create_widgets(self): B_PAD = 4 PAD_X = 3; PAD_Y = 2 NUM_PAD = 7 '''Create Boolean variables for all the buttons.''' def create_button_vars(): self.backspace = BooleanVar() self.CE = BooleanVar() self.C = BooleanVar() self.MC = BooleanVar() self.MR = BooleanVar() self.Mminus = BooleanVar() self.num = [] for i in range (10): …

Member Avatar for vegaseat
0
130
Member Avatar for chavanak

Hi guys, I have a list which I have obtained from a python script. the content of the list goes something like [CODE] d.complex.1 24 25 67 123 764 d.complex.2 23 54 35 64 d.complex.3 . . . [/CODE] I want to split this list such that, a new list …

Member Avatar for vegaseat
0
93
Member Avatar for Friktion

hello everybody, im coding a game with opengl,pyggel,python,pygame etc and it runs smoothly without any problems =) [url]www.youtube.com/watch?v=JlDuje39S_8[/url] - My python 3d game projekt <--- sorry if outside links isnt allowed =( But the thing is that when im compiling it with py2exe using this as setup.py [CODE=python] from distutils.core …

Member Avatar for vextorspace
0
429
Member Avatar for shyami

Hi, I need to define some common variables in one file and use that file in my python script , Like in php we define some variable in (eg :definevble.config) file, later we will use that file using include method in php script. Plz let me know how to do …

Member Avatar for shyami
0
123
Member Avatar for Fridericus

Hello everyone, I have a problem with TkMessageBox on Windows: My program receives a message from a server and then it should show a MessageBox, but instead of doing so, the program freezes. Elsewhere in the program, a MessageBox is called after the user having pressed a button, and this …

Member Avatar for Fridericus
0
388
Member Avatar for polopaul

for seq_record in SeqIO.parse(open("mm.fa"), "fasta") : I am using the above code to read fasta files. But when the number of sequences record exceed about 30000, the python return this error: Traceback (most recent call last): File "C:\Python26\Neutral\AICMM.py", line 28, in <module> if (seq_record.seq[count] == "A") : File "C:\Python26\lib\site-packages\Bio\Seq.py", line …

Member Avatar for woooee
0
98
Member Avatar for peppermints

I am trying to modify this trivia program to read scores from a separate text file and then add the scores to a running total if the user answers correctly. Here is my code so far: [CODE]# Trivia Challenge # Trivia game that reads a plain text file import os …

Member Avatar for woooee
0
199
Member Avatar for TotalyWired
Member Avatar for marcux

Hi all! I am building a small app with pygtk as the gui. I have a thread that communicates over the network and when the user clicks a button I want a variable to be updated in my communication thread. I have made a class that subclasses Thread: [CODE] class …

0
49
Member Avatar for kiri88

Hi? i'm new at programming and im trying to decipher a code. i'm trying to count how many times a char occurs in txt file

Member Avatar for ihatehippies
0
92
Member Avatar for Lolalola

Hi, how change in zope cmf server Document portal type? "Workflows This object's portal type is: Document. " I wish: "This object's portal type is: My new Document." Thanks

0
197
Member Avatar for persianprez

When running my code, I get a "substring not found" not entirely sure what that means..here is my code:\ [CODE]filename = open('code.txt','r').read() string = filename def decode(string): abc='ABCDEFGHIJKLMNOPQRSTUVWXYZ' n=1 result='' for rotate in string: result+=abc[(abc.index(rotate)-n)%26] n+=1 print result def main(): decode(string) main() [/CODE]

Member Avatar for persianprez
0
128
Member Avatar for linux_mania

I want to make a programme for adding data in my my database(mysql).I did everything right and i can add,delete,change,get data using MySQLdb. My problem is when i want to add gui(Tkinter) i get error message.I googled and did everything to solve it but stucked.Please help me!!!!! my code is: …

0
57
Member Avatar for ihatehippies

This is my first experiment with sockets. Its kinda like the beginings of a VNC app. The basic gist is that one file on computer "A" takes a screenshot of the computer screen and sends it to computer "B" where another file accepts the connection and receives the data. Computer …

Member Avatar for Tech B
0
156
Member Avatar for hondros

Okay, here's what I am up to now. I am trying to figure out how to write sin waves to a .wav file, for playback. Here's the issue: I have no idea what I'm doing. I looked up the documentation for the wave module, and have been able to open …

Member Avatar for hondros
0
180
Member Avatar for JustAnotherJoe

I can't figure out how to set a radio button within a filemenu. I can use myRadioButton.SetValue( True ) outside of a filemenu. What I'm trying to do is to automatically set a particular radio button dependent upon the last value used. [code=php] import wx class MyFrame(wx.Frame): def __init__(self, *args, …

Member Avatar for JustAnotherJoe
0
853
Member Avatar for fallopiano

Here I have a simple range function that can use floats as steps or increments. In a time test (using Psyco 1.6, python 2.5, and a basic PC), the normal frange function was able to go up to 1,000,000 from 0, by .3 , and finish that in about 0.5929 …

Member Avatar for Gribouillis
0
576
Member Avatar for vegaseat

You can use Python modules math, wave, and struct to create and save a synthetic sine wave of given frequency and duration (size) ...

1
3K
Member Avatar for AnnetteM

Hello, I would like to add a six-line header to a data file for many files in a loop. However, I need to add the header to a data properly first... My inclination (as a python novice) is to write the header and append the data to the header. However, …

Member Avatar for AnnetteM
0
2K
Member Avatar for sindhujavenkat

Currently I am working with multiple layouts now. Is there any way that I can save the state of the layout, and shift to the next layout and restore the state when I return back to the layout?

Member Avatar for strider1066
0
72
Member Avatar for hondros

Hello everyone, my latest project is this: 1) Ask user to input a function 2) Plot said function Well, I figured out how to strip the function into two parts, input a number, and evaluate the function. That all works fine outside of a defined function I created. The trouble …

Member Avatar for hondros
0
115
Member Avatar for Purnima12

[CODE]import time import calendar # time tuple/list index YEAR = 0 MONTH = 1 DAY = 2 WEEKDAY = 6 # weekdays MON=0 TUE=1 WED=2 THU=3 FRI=4 SAT=5 SUN=6 # months JAN=1 FEB=2 MAR=3 APR=4 MAY=5 JUN=6 JUL=7 AUG=8 SEP=9 OCT=10 NOV=11 DEC=12 HAVE_30_DAYS = (APR,JUN,SEP,NOV) HAVE_31_DAYS = (JAN,MAR,MAY,JUL,AUG,OCT,DEC) HAVE_28_DAYS …

Member Avatar for vegaseat
0
1K
Member Avatar for dev777

Hi My question relates to Python GTK I have an image -a JPG - which I draw onto a drawing area. I want to reveal a portion of the image -say a 10pix by 10 px square -only where the mouse pointer is currently at. Everything 10 x 10 px …

0
112
Member Avatar for bharatk

Hello I am trying to use Visual Tkinter but it's giving an "Invalid procedure call" error each time I try to place something on the form and the program closes. Screenshot of what I'm getting: [url]http://i48.tinypic.com/10zy5br.jpg[/url] I'm not even able to add a simple button to the form & when …

Member Avatar for macroasm
0
398
Member Avatar for AnnetteM

Hi, I would like to read data from an .asc file with a six-line file header. I just want the data without the header. I'd like to start at the 7th line and go until the end collecting the data into a single list. Each different data file I'm looping …

Member Avatar for Gribouillis
0
3K
Member Avatar for minillinim

Hi, I'm a c++ guy trying to learn python. I'm trying to code something which models how a jukebox would work. The code I've attached simply adds numbers to a list on keypresses (enqueuing) and then other threads remove them (the player). My problem goes like this: When I press …

Member Avatar for Stefano Mtangoo
0
92
Member Avatar for soUPERMan

Hello, im trying to use a function inside another function and getting an error: The function: [CODE]# Function that recieves number of characters and calculate cost of advertising def costAd(numChar): if numChar >= 15: cost = 35.00 else: cost = 35.00 + ((numChar - 15) * 3.55) return cost costAd()[/CODE] …

Member Avatar for soUPERMan
0
178
Member Avatar for wtzolt

Hi, What I'm trying to do is to write a script which would open an application only in process list. Meaning it would be "hidden". I don't even know if its possible in python. If not, there has to be a function would allow for a program to be opened …

Member Avatar for vegaseat
0
6K
Member Avatar for firstimer04

Evaluation of formula G =((p→q) ^p)→q and the output display the result of true false' conclusion if it is a valid, invalid or inconsistent.. thank you for any response its a big help to my study her's my unfinished code [code] import sys p=[True,True,False,False] q=[True,False,True,False] a = [] def p_AND_q(p,q): …

Member Avatar for Gribouillis
0
90
Member Avatar for gangemia

I have a text file that contains Road Name types paired with their abbreviated form. For example: ... Avenue,Av Road,Rd South East,SE Terrace,Tce ... How do I a create a dictionary variable from this CSV file in python 2.5.1 so I can get it in this form? {...'Avenue': 'Av', 'Road': …

Member Avatar for jice
0
236
Member Avatar for pankajpriyam

Hi, I have tried to send email through python code the code is - import smtplib from email.MIMEText import MIMEText #try: s = smtplib.SMTP() s.connect('') # I have given server name of email s.sendmail("","","test") # i have given from user and send user print "Succesfull" s.quit() #except: # print "Error …

Member Avatar for jcao219
0
159
Member Avatar for XD3ADX

[CODE] import random unordered = range(10) random.shuffle(unordered) list = [] list = [0,1,3,4,5,2,6,7,8,9] def selection_sort(list): l=list[:] sorted=[] while len(l): lowest=l[0] for x in l: if x<lowest: lowest=x sorted.append(lowest) l.remove(lowest) return sorted [/CODE] im trying to manually sort a list of integers from 0 to 9 using selection sort. i cant …

Member Avatar for woooee
0
77
Member Avatar for sindhujavenkat

I am currently working on a central widget with multiple layouts. I want to display few items in the statusbarin one widget and when I shift to the other widgets the items in the statusbar shouldn appear. How can I do this?

Member Avatar for vegaseat
0
89
Member Avatar for baki100

What method / methods should be be used in order to get the frame to start up in a central position of the screen, and could you also provide the code please. I'm using wxPython. thanks

Member Avatar for baki100
0
274
Member Avatar for gruis

i see how this code prints s which is 'cad' but, then it somehow backtracks to print s again which is 'cat' according to the results after i execute it. can someone walk me through how this works? it would be a great help. [CODE]def eds(k,L,s): """ starting with the …

Member Avatar for Gribouillis
0
91

The End.