15,185 Topics
| |
[CODE] #! /usr/bin/env python import random possible = [2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 30, 34, 50, 100] size = int(raw_input('Please enter the size of the die you would like: ')) if size not in possible: print """ Please check the Wikipedia Dice … | |
Okay, so I have about 6 GB of music on my iPod. I don't want to go through and copy everysingle file and rename it manually, so I am making a python script to do it for me. I would just like to have some feedback on my code, make … | |
This simple script will copy all music files that were not purchased from the iTunes store to a directory of your choosing. It requires the ID3 module (Created by some person, from somewhere, I forget where, but I DID NOT make this module). The syntax is as follows: [code] ipoddir … | |
Hey, how's it going? I decided to pick up Python for the heck of it and have been having some trouble creating this Card Deck class. All this class is supposed to do is initialize a deck, and then draw a card at total random: [code] import random class CardDeck(): … | |
Hi, Sorry if this is asked before, but I'm having trouble figuring this out (tried already for a couple of hours). This is what is going on: Kids make a test with 50 question. These test are checked manually on paper and afterwards need to be put into a website. … | |
If you don't know what a quine is, it is a program or script that's only purpose or function is to print out its own source code. I was wondering would this be considered a quine? [CODE] f = open("quine.py","r"); print f.read() [/CODE] quine.py is the script that this code … | |
So for example, in the dictionary, the letter 'A' has a value of .8237 What I wan't to do is replace every letter with the value with .8237 to D in the string (not the dictionary) I've tried this without success and It's obvious why it wouldn't work: [CODE]if sorted(dictionary.values())>=.01: … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 ( … | |
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 … | |
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()) … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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")? | |
[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): … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
I wish to relate on some Pseudo Code if you Please !!! |
The End.