15,180 Topics
| |
I am working on this program in Python that would allow me to scan for a certain phrase in a certain text document. I used the finditer function in Python's re library.The certain line of code resembled the following: [CODE]phrase=regex.finditer(page)[/CODE] I also had a print statement at the end that … | |
Hello! I'm just beginning to learn Python and I would like you to recommend me any good tutorial. I have started with the [URL="http://www.pythonlearn.com/"]http://www.pythonlearn.com/[/URL] and the [URL="http://hetland.org/writing/instant-python.html"]http://hetland.org/writing/instant-python.html[/URL]. I have found them very useful and I would like to continue learning. Furthermore, I would also like to start learning on programming … | |
Hi, i have created python exe file of my code using py2exe module. i need to add my own customized icon for this exe file how to achive this | |
I'm trying to figure out how to set up a grid using a list of lists. I want the input to be x where the program will then setup a list of x lists, each containing x entries, in this case "0"s. | |
Ok, so i've got one definition on my python code, that defines how to find the position of something in an array, then returns the list of all the places that those things are. Then I've got another definition to find the accurate centroid of a position. How do I … | |
I am working on a project where I need to parse a bunch of user text that comes in different fields. The problem is that the user input doesn't always come in on the same fields. One user might have a name in field 3 and a date in field … | |
try to get the current cursor position without removing the node [CODE]class List(object): ___slot___=('cursor', 'size') def __init__(self): self.cursor=EmptyCircleNode() self.size=0 def __str__(self): result = "<" node = self.cursor count = self.size while count != 0: result = result + str(node.data) if count != 1: result = result + ", " node … | |
I am new to python programming and struggling with a problem I would like help with. I have multiple text files that I would like to join using the first column in each file to serve as the key to align the files. Each file could be several hundred lines … | |
Hey guys I'm having some trouble with a homework question from Zelles python. I have to make a Set class then test a variety of methods. However my teacher wants us to just use lists and not actually sets. I'm getting an error for the setElements method, it keeps saying … | |
Problem with storing extracted values in SQLite - How to adress or index list of values for proper insertion into table. The Regex works fine: input logging data looks like: 0.0.0(06026104) 1.6.1(0.1501)(1011111000) 1.6.1*32(0.1446)(1010190800) 1.8.1(02484.825) 1.8.1*32(02449.574) correct regex output: 06026104 0.1501 02484.796 [CODE] with open("usage.log") as fp: for line in fp: … | |
(Python begginner, please be gently) Hi, i'm having some troubles with turning one python project i made into an executable, using py2exe (via GUI2EXE). The program is compilling well, it generates the executable, but when i try to execute it, i get the following error: ImportError: No module named twitter … | |
So far, I have: [CODE]def printSquare(x,y): for z in range(0,x): print(x*y)[/CODE] printSquare(3,'%') prints out something like this: %%% %%% %%% instead of using the '*' operation, is there a way to print x numbers of y separated by commas (for better spacing) ie: print(y,y,y)? | |
Hi, I want to know how to use Python variables in My sql statement and below is the syntax i am using import MySQLdb name="XYZ" number="123456" db=MySQLdb.Connect("localhost","root","12345","phone") cursor=db.cursor() sql= ("""INSERT INTO phonebook(number, Mobile) VALUES(%s,%s)""" , name,number) cursor.execute(sql) db.commit() db.close() but this throws the error please refer the attached screen shot … | |
Read and Write Image in Python 3.1 ? No lib Thank you so much. | |
Hi there, at university i have to program OO-style in Python. What i got now is a "Point"-class and a "Triangle"-class. The "Triangle"-class has a method [ICODE]a()[/ICODE] that needs to return the length of the AB-edge, but it doesn't instead it concatenates the Point.__str__() methods return values together, which is … | |
it keeps looping over and over again no matter what i put in [CODE]def getScores(totalScores, number): score = input('Enter their score: ') while score <=0 or score >=100: print'You must enter a number between 0 and 100' score = input('Enter a number between 0 and 100:') for counter in range(0, … | |
i get this error when i get to a certain part in the program Traceback (most recent call last): File "C:/Users/Family/Desktop/13.py", line 54, in <module> main() File "C:/Users/Family/Desktop/13.py", line 10, in main averageScores = getAverage(totalScores, averageScores, number) File "C:/Users/Family/Desktop/13.py", line 46, in getAverage averageScores = totalScores / number TypeError: unsupported … | |
hi all, can anyone tell me hoe to open a file from one machine, when the file is present on a remote machine, specifying it's IP address? | |
I am struggling with one part of my specification to complete my program :/, currently it does let me enter different items into containers and creates new containers as they are needed. However now I need the program to handle how it packs the items differently. Before when numbers such … | |
I'm trying to convert text to a variable name. So far, I've been able to solve most things with Google, but this is really frustrating: Error: Traceback (most recent call last): File "C:/Documents and Settings/Some_Kittens/Desktop/Lab20/worldClock.py", line 33, in <module> main() File "C:/Documents and Settings/Some_Kittens/Desktop/Lab20/worldClock.py", line 21, in main while not … | |
Hi! I've created three list in a class but when I print them i get <__main__.Kort instance at 0x16eb22b0> Anyone know how I can get the list to print put its "real" elements? [CODE] class Kortlek(): def __init__(self,colors=["blue ", "yellow ", "red "], forms=["triangel", "circle ", "square "], numbers=[1, 2, … | |
i have an introduction to programming class and i'm trying to write this program and the program is supposed to loop if you don't input a number within a specific range but it doesnt do it [CODE]def main(): endProgram = 'no' print while endProgram == 'no': totalScores = 0 averageScores … | |
My problem is that i have to create a program to hold a series of weights in containers (elements in a list). The max weight for each container is 20units. I have got this working as this: containers = [0] inp = input("Enter a weight, 20 or less, or enter … | |
Hi! I'm working on a solitaire game, with a different card deck. First I create a big list with 81 elements (cards in this case), cardList. From this list, six cards are ramdomly picked and put into another list, playerCardList, and printed on the court. Once the cards are printed … | |
Hey, I've got an array full of random numbers and I want to say if the array is below a certain value, say 15, then to make everything in that array that less than 15 equal to zero. So far I've tried a few things and they've not worked, and … | |
I have these 3 string: YELLOW,SMALL,STRETCH,ADULT,T21fdsfdsfs YELLOW,SMALL,STRETCH,ADULT,Tdsfs YELLOW,SMALL,STRETCH,ADULT,TD I would like to remove everything after the last "," including the comma. So i want to remove these parts ",T21fdsfdsfs" ",Tdsfs" and "TD". How could i do that in Python? | |
Hi people. I am having trouble printing out a list of items with n items per line. Here is my current code. [CODE]def printList(lst, lineCount): # given a list of items, print it out in # lineCount items per line. count=0 strList= '[ ' for element in lst: strList = … | |
Please look at my code at: [url]http://www.bpaste.net/show/11961/[/url] I appear to have gone down a "blind alley" here. Having identified the location of the Word perfect headers, I need to verify that they are indeed genuine by reading the hex value 10 bytes from the beginning of the header. If it … | |
This snippet generates the best rational approximations of a floating point number, using the method of continued fractions (tested with python 2.6 and 3.1). | |
This issue is probably discussed before. However, I can still use a little insight. I am a python beginner looking to develop a small client/server suite. The clients will reside in different PCs across a LAN and their job is to recieve a file (say, a .txt file) from the … |
The End.