15,406 Topics
![]() | |
I need to find a way to print "Cannot find birthday" if the "searchline" is not found in the "pidigits" file. Maybe using a count somehow. I've tried a lot of different things, but I cannot figure it out. I have attached both files. [CODE]import string def find(): blength = … | |
please tell me that there is a difference because i've spent an entire week figuring out how to make cTurtle work. Now that I have succeeded, both modules appears to have the same functions. Please tell me that there is a difference | |
Hey all, This isn't so much a question as a heads up... After using python for a few years (mainly doing blender scripts and random console/command-line apps and tools) I've recently started looking into doing some GUI based stuff using wxPython. I've had a look at a few of the … | |
I have a text file that I need to find data and assign it to a variable. I have found code to read and search a file but the information I want is not always constant. The Items in Red will change. Is there a way to find this information, … | |
Hi, I'm pretty new to python but thought I'd write something to read [URL="http://www.zyrus.org/log2.log"]this log file[/URL] to try and learn it. Ideally, it will read this log file, match a string and return everything between the "****" delimiters where the string was matched. I'm not 100% sure how to go … | |
![]() | Hi everyone. I'm new here and would like some help with some Python code. I'm trying to use modulus to shift decode an input line (regular sentence or word like "Bill") but I keep going over the regular alphabet in ascii and the "B" becomes an "=" How do I … |
Basically I am creating a function to determine the perimeter of a polygon based on the vertices. The input parameter is an xyList that contains the coordinates, basically a nested list of coordinate pairs within another list, like so: [ [x1,y1], [x2, y2], [x3,y3], ...] I am using the good … | |
Here is what wxPython Demo says about it: [QUOTE="Robin Dunn and Crew"] [COLOR="Red"][B]Although Microsoft has deprecated the MDI model,[/B][/COLOR] wxWindows still supports it. Here are a couple samples of how to use it - one straightforward, the other showing how the MDI interface can be integrated into a SashWindow interface. … | |
I tried to start up python for the first time, but it said the handle was invalid, any clues? | |
I packed a Python script (that uses pyGTK) into an .exe with py2exe. It runs fine, except that the normal GTK theme does not show up. This is what it looks like when I run the script: [url]http://img33.imageshack.us/img33/4080/16sepwed1827.png[/url] And this is what it looks like when I run the .exe … | |
hello every body i rewrote my game into pure opengl and pygame i have finished things like camera movement and other stuff. Now i really need help with the collision it basicly works even if the box/objekt is resized but now i want it to work when the objekt/box is … | |
hi i want to make some auto login script. anyone can help me make this auto login script? i was tried but failed. anyone can make this one to work? thanks a lot [code] import sys,os import mechanize, urllib try: id = 'kimok222' pw = '1qaz2wsx' params = urllib.urlencode({'adult_yn':'N', 'encoding_type':'utf-8', … | |
hi, I just created this awesome python application and i want to spread it around, but every one has python. I was just wondering if I could compile python source into a linux executable like py2exe, and then compile the executable into a .deb installer file. any help would be … | |
Okay, I was thinking about making an encryption algorithm, now the thing with most algorithms is that they follow specific steps. Well, I was thinking, what if you made an algorithm that generated random characters (the kind you see on your keyboard, excluding characters that could crash the program), and … | |
Here is the code I have so far: [code]import re from urllib.request import urlopen pg = urlopen('http://www.url.com') pg_r = pg.read() pg.close() print(pg_r) print(re.search('(?<=http://user.url.com/)\w+', pg_r))[/code] What I *want* to do with re.search is find the word between the strings '[color=#0080FF]http://user.url.com/[/color]' and '[color=#0080FF]"[/color]' but I'm not sure how to do that.. Can … | |
Hi everyone, hope someone can help me or guide me since python really something new for me. I use argv to read some input from user. My problem is i don't know how to read the input as a list. Assume that user should give --n and --file as input … | |
Hello, I'm not a programmer just a user of an application that won't work and gives a pythonw.exe error whenever it's run. I've tried asking for help on [URL="http://www.techsupportforum.com/microsoft-support/windows-vista-windows-7-support/415953-pythonw-exe-not-responding.html#post2357086"]windows tech forums[/URL] but they don't have any answers so I thought I would try here. Forgive me if this is not … | |
Hi I want to prompt the user to enter the date dd/mm/year and use this later as part of filename and later as object in file(if this helps searching). Does using datetime ensure that user input will be a valid input? I would like the output to be year-mm-dd My … | |
my code is: [CODE] import urllib import urllib2 import re #get URL urla='http://www.sc.iitb.ac.in/~bijnan/personal-details.htm' #connect to this website request=urllib.urlopen(urla) #get html file from this website html=request.read() #get the address from above html file print html [/CODE] How can i find all his addresses in this html,can use the re.complie() method to … | |
For weeks I've been using the same code without any problems. I call SIGNAL within a thread and it's working like a charm. Then I bring the same module home to the same environment (Ubuntu Jaunty, Python 2.6) and now I'm getting this error: ValueError: signal only works in main … | |
This question, as the title says, is specific to the new file tagging feature in Windows Vista. Basically, I want to make a tag cloud for a certain folder, and in order to do this, I need to access all of the tags of the files in the folder. What … | |
Well I'm trying to make a phone book program and I need some help what I want to do is add a ListCtrl to my frame so I can see the names and numbers of people in my phone book but I am unsure how to do this. Here is … | |
Is there an open source (lgpl, bsd, mit) math parser/lexer library available out there? Has anybody ever written one by themselves (with support for variables, exponents, grouping) and have some tips/hints? | |
Ok so I am attempting to make a program that downloads files from a site that are similarly named. For example, there is a site with files that are named blarg-0001, blarg-0002, blarg-0003, etc, until blarg-0020. Well the purpose of my code is to download those and everything inbetween but … | |
Hello, I'm trying to learn how to create a very simple class just to get the basics of OOP in python. I figure just to learn I'll start with a class where I can create an object and use a method to update a string associated with that object and … | |
I am new to python and programming this is my first time using the code (first assignment). I need help with writing a program to convert the code message entered by the user into ascii numbers, then find which number occurs 12% of the time, and have it represent the … | |
![]() | Hi, I have this code: [code=python] import urllib2 as url import webbrowser def extract(text, sub1, sub2): """ extract a substring from text between first occurances of substrings sub1 and sub2 """ return text.split(sub1, 1)[-1].split(sub2, 1)[0] start="http://xkcd.com/" permlist=[] textlist=[] for i in range(1, 638): temp=start+str(i) permlist.append(str(url.urlopen(temp).readlines()[88])) textlist.append(str(url.urlopen(temp).readlines()[77])) for i in permlist: … |
Hello! As the title suggests I need some help regarding an "open directory" dialog box. I tried this code but every time I run the module it appears a blank window in the back of the dialog box and normally after I select the directory it should disappear but it … | |
I'm having trouble getting this program to keep going through the lines in the first loop. It just prints out the output for the first (searchline) and stops. Can anyone help me to figure out why it won't keep reading the lines in the birthday file? [CODE] import string def … | |
I need a back-end that can: -be used in python -handle multiple-users reading and writing to a database at the same time -can be accessed on a mapped share drive I have used sqlite but I have read that it is not recommended for multi-user use. I have looked into … | |
I'm trying to write a python program that guesses a number that the user chooses between 1 and 1000 in no more than 10 guesses and I can not figure it out for my life! I know it's super beginner and there are a lot of problems, but please be … | |
Hi all, I'm fairly new to programming in Python, and I have been getting on pretty well. I had a little working program compiled from old code snippets I had found online, converted to working 3.x code and combined together with some of my own ideas to create simple apps. … | |
How can i extact the personal address from html file.. After i get the source from the html file using read() method,what pattern should i consider if i wanna extact the address? Currently i think is use the compile() method to set the matching the address' pattern, but what rule … | |
My code is: [CODE] import re import urllib import urllib2 webURL="http://www.sc.iitb.ac.in/~bijnan/personal-details.htm" #the website is connect=urllib.urlopen(webURL) #connect to this website htmlDoc=connect.read()#get the html document from this website patternIN="Permanent Address" # Where to begin to keep the text patternOUT="</tr>" # Where to end to keep the text (after the begining) keepText=False # … | |
[CODE] for line in infile: if(line[len(line)-1:] = "\n"): line = line[:len(line)-1] output = "Searching for: " + line search.append([line,output])[/CODE] Giving me the error: [QUOTE] if(line[len(line)-1:] = "\n"): ^ SyntaxError: invalid syntax[/QUOTE] I'm basically trying to take each line of the file and I want to exclude the newline character at … | |
Hi All I am working on the project detailed below and need some help please. The flow diagram is the best I could do, I'm afraid. I need some direction as to what function to use to undertake the pointing to various lines of text and also the instruction to … | |
Sorry guys! Last time I posted, I didn't know about code tags! I put them in. SO, I'm trying to write a python program that guesses a number that the user chooses between 1 and 1000 in no more than 10 guesses and I can not figure it out for … | |
I am new-ish to python and need to write a short program which will take a file with many lines of sets of coordinates alongside a defined variable of a series of letters and out a 3 columned file with columns x, y, and letter. the input file has each … | |
Hi All! I am VERY NEW to Python and I am trying to make a program that can generate random words from a list of letters given to it. The command line can be: [I]program.py abcdefghi[/I] and then as a result the program will print all possible 9 letter words. … | |
Hi all, A question for you. I have these types of files at my work (.sj extension) that I need to work with and I'm wondering if there is a way to read from the file like a text file (the .sj files can be opened / read by notepad). … | |
I've created a few functions to be used with pygame which are based on anti-aliased curves. At the moment and likely forever, it has two useful functions: aacircle(s,x,y,r,colour): Draws an anti-aliased circle on the surface s at the starting point x and y with the radius r. The circle will … | |
Sorry guys...this is probably really trivial but i'm new to Python. How do you remove the first digit from a five digit number called x and then add this new number to the original x. I need to be able to remove any of the digits and add the new … ![]() | |
Hello, I am trying to compile a working opengl project into an executable for windows. I ran into several import issues in the python imaging library, Numeric, and OpenGL. I managed to resolve all but the OpenGL ones. There is quite a bit of conflicting info on the subject out … | |
Hi, The following code (BLOCK 1) is intended to simulate a television by creating it as an object, and is it stands I am pretty happy with it. Having created a volume control however, I then wanted to add a brightness and contrast control. My first attempt at doing this … | |
Hello all, I recently started using Python to test a Bluetooth Push application prototype and everything was working great until threading. I wonder if someone knows how to start multiple threads of connectpush() with Obexftp running under Linux? So far with the code below I have to wait until the … | |
hi all, i have a file that contains the following data (just a sample) : [code]501 0 0.932 0.933 0.931 0.931 0.929 0.933 0.93 0.928 501 1 0.974 0.98 0.978 0.976 0.974 0.974 501 2 0.953 0.949 0.944 0.951 0.942 0.942 0.942 0.948 501 3 0.933 0.934 0.934 0.935 0.931 … | |
I am having a little trouble grasping this subject in my book. The book gives the program : [CODE]def main(): fname = raw_input("Enter filename: ") infile = open(fname, 'r') data = infile.read() print data main()[/CODE] "as a program that prints the contentsof a file to the screen using the read … | |
Write a unit conversion program that asks the user to identify the unit from which they want to convert and the unit to which they want to convert. Legal units are inches, feet, miles, millimetres, centimetres, meters, and kilometres. Convert from? Inches Convert to? Millimetres Value? 10 10 in = … | |
Hi folks I have just completed my first programme with help from yourselves. I cant understand why the code , if x ==1 or 2, wouldn't work in my programme below [code=python] # Convert C to F or F to C and return with result select = True while select: … | |
I am new to programing and am impressed with the ease of python/wxpython. I have written useful wx programs to enter data into MySQL databases, but am stuck on making a useful wxpython MySQL query progam. I have had success writing query apps in python. I'm hoping to find a … |
The End.