15,406 Topics
![]() | |
Hi, I'm having a bit of a problem outputting to a file. I am trying to output each element of a list into a document on a new line and I can only get it to work when all the items in the list are on the same line. The … | |
Hello guys, I am new around here. Anyways, I am having a problem with reading some information from a text file. Sample text file: density = -1.0 number = 2004 Ok so what do I use in order to get the number -1.0 from the text file? Also, what if … | |
Hey guys, I'm making a platform game similar to Super Mario in Pygame and I want to add platforms i.e. I have a background picture that has platforms drawn on it. I then want to make it so he can only go down as far as the platform, and as … | |
Hello everyone, My file has lines like: >9|102396631|genome..... CCACTTTCTCTCCGCGCTGGGTTGAACATGGTACATCAGACTCCCTGAATCTGTCAGATC TCTTGGTTGCTGTTGACAACTAAGACTTCGGAGCCTGGAG_GATTTGTTGAGGGGGAGCA GTTCTGGGTGTCCTCTGCTGTGACTGGGCTCCCGGCCTCTTGATAATGCGCAACAGCTGC GGTAGAACATCTCATTCCCAG >9|102362951|ENSRNOS.... I want to delete blank lines from this file please help me... Thanks | |
How do I import a variable from another function in the same class [code=Python] class W(object): #my class def variable(self): #one of my functions f = 5 def printf(self): #what do i put here to import f from the function variable... #I'm currently working with python 3.1. #I know its … | |
Hello, I have an application written in python and Tk. My application is to be scriptable with python, i.e., the user gives a small piece of code written in python, and that is to be executed by my application in a different interpreter, with different set of local variables. I … | |
Hi All, I am using the below code to write into a text file [CODE] # Write into log file inp=file(Doc\Log.txt, 'w') inp.write('Log file start') inp.close()[/CODE] The text file 'Log.txt' is present in 'Doc' folder inside the application folder. Now I want to create a text file with a time … | |
If I wanted to save the binary information of an executable as a string object in a .py file what would be the easiest way to go about that without receiving null byte and EOF errors.. I've messed around with converting each char to its ordinal and then separating them … | |
this script give me a memory error in parse()...what is a memory error and how can i fix it? [code] import cgi class COM: def __init__(self): f=open('C:/site/commentlog.txt', 'r') self.lines=f.readlines() f.close() def writecom(self, post): f=open('C:/site/commentlog.txt', 'a') f.write(post) f.close() def getcom(self): try: form=cgi.FieldStorage() q=form.getvalue("posts") if q: writecom(q) return q except: return 0 … | |
I feel like I'm losing my mind... I uninstalled wxPython this morning and was going to reinstall with the latest version as I'm having peculiar problems with UliPad that I just downloaded yesterday. Well after uninstalling the wx package and docs & demos I went to the wxPython page and … | |
![]() | Hi there, I have the following string which is tab seperated [code]dasj dhsahdwe dhasdhajks ewqhehwq dsajkdhas edward das dsaw das daswf fjdk ewf jken dsajkw dskdw hklt ewq vn1 daskcn daskw[/code] How can I format it in python in order to make each column to have the width of the … |
Ok so for the last couple of days I have been struggling with file handling. Here is my problem I create a new file and write some text into it. Then I open it again to add more text to it but somehow the new text is being written in … | |
So after some scrambling around trying to find a good beginner programming language, i have found python, and with my ultimate goal being game development, also pygame. I have just started learning some basics, and I was going through a tutorial when i ran into an error that im not … | |
What is the difference between these two methods; [CODE=python]# Solution 1 list1 = ['a', 'b', 'c', 'd'] temp_list1 = list1 for i in range(len(list1)): temp_list1[i] = "1" print list1; # ['1', '1', '1', '1'] print temp_list1; # ['1', '1', '1', '1'] # Solution 2 list2 = ['a', 'b', 'c', 'd'] … | |
[U][B]Guidelines to OPs:[/B][/U] [U]Before you start a thread:[/U] Starting a thread is a critical task. It is so because it demands time and attention of other forum members. A thread should only be started when you have done enough drill to find your answer else where. You should always be … | |
Can anyone give me a qick review about Python Why its good ? Why its not ? What is the most suitable type of project for it ?? (application) And so one Thanks for your help | |
Hello everyone, My file has text like: gnl|dbSNP|rs13484118 gi|62750812|ref|NC_005111.2|NC_005111 95 20 1 0 68 87 31017559 31017578 4.4 32.3 gnl|dbSNP|rs13484118 gi|62750812|ref|NC_005111.2|NC_005111 91.67 24 2 0 63 86 35247737 35247714 4.4 32.3 gnl|dbSNP|rs13484118 gi|62750812|ref|NC_005111.2|NC_005111 91.67 24 2 0 64 87 40549054 40549031 4.4 32.3 gnl|dbSNP|rs13484118 gi|62750812|ref|NC_005111.2|NC_005111 92 24 2 0 63 … | |
[url]http://www.i-programmer.info/tinyURL.php?id=189[/url] Is a review and discussion of using Python as a first language. mikej | |
Hello, I'm currently working on a little soft to plot some data from CSV files. I've got two problems. The first one is on CSV opening in procFile method. When I try to open a file with a path which own "é" characters for example, it raises an error. I've … | |
Hi! I'm creating metadata to a bunch of files and have problems figuring out how to do this. The python script should be able to create one xml document for each file in the directory. The problem is not to walk through the files but to create additional metadata to … | |
I am trying to write a program that will help me with Gold Rush...This is a game on moola.com. Gold Rush is the most popular game available for players to wager their winnings on. It involves a series of six blind bids on gold nuggets with various point values. The … | |
Hey I use both windows vista and Ubuntu (mostly) for developing small py scripts. I wanted to know if there were any libraries or modules available to get information about system resources like : - Source of power (ac or battery) - how much battery time is left - Is … | |
![]() | hii everybody, I have a weird problem with a program for solving sudoku puzzles. I am representing the puzzle as a list of lists of lists containing all the possibillities for a single square and my problem is that when I try to remove a single appearance of a number … ![]() |
Hello everyone, my file1.txt have sequences as given below: >1|62798264|[COLOR="Red"]rs8174605[/COLOR]|T/C||dbSNP|T/C AAGAGGAGAAAGCAAAGTTGCAAAAGGTGAAAGAGAAAGAAGAGCTAGAGAAGGGCAGGA AGGAGCAGAGTAAGCAGAGGGAGCCTCAGAAGAGACCGGA_GAGGAGGTGTTGGTGCTCA >1|100159271|ENSRNOSNP145|T/A||ENSEMBL:celera|T/A TCTTATAATTAGTCATTGTGATAACTGCTACAAACAAAGTCACAGGATCTTGTGAGAGAA >1|19033646|[COLOR="Red"]rs8173848[/COLOR]|C/T||dbSNP|C/T TTGCAAAAAAAAAAAAAAAAAAAAAAAGCCAGAATCCAGCATAAGTCAAGGAAATCCACT >1|149643853|[COLOR="Red"]rs8173465[/COLOR]|G/T||dbSNP|G/T AACAGAGACAGCTGTGATGTACCCCATGAGCTGGAAAGAGCAGCCCAGCGGTGTCCCAGC >1|101456015|ENSRNOSNP1318|G/C||ENSEMBL:celera|G/C AACTCTTAGAAGTTAGAACCTGGGGTGGAGAGATGGCTTGGTGGTTGAGAGCATTGACTG I want result file which do not have sequences with "rs"number e.g rs8177678, these are colored red in each sequence. so my output file should have 2 sequences: >1|100159271|ENSRNOSNP145|T/A||ENSEMBL:celera|T/A TCTTATAATTAGTCATTGTGATAACTGCTACAAACAAAGTCACAGGATCTTGTGAGAGAA … | |
hello everyone, my file has many long lines witth 12 ccolumns like: gnl|dbS|13484118 gi|62750812 100 16 .......around 12 columns gnl|dbS|13484888 gi|62750812 95 20 ....... gnl|dbS|22484118 gi|62750812 92 20 .......... I want to grab the lines where values of column 3 lies between 90 - 99.9 in the file and store … | |
Can this be done in Python?.. which is done in perl. [CODE=perl]open(TEST,">test.txt"); *STDOUT = *TEST; print "print somting..."; print "print somting..."; *STDOUT = *FHSAVE;[/CODE]All the print statement between the lines "*STDOUT = *FHSAVE;" will be written in to test.txt. Is there any way to do this in python. Thanks. | |
Hi, I have my own widgets ( simple one) and want to put them in one file and call them from second file. This is like easygui but with pyqt4. My problem - when I call my widget from second file nothing happens. This is file with widgets (example). [code … | |
Ok so I was working on file handling, nothing special just making new (.txt) files and putting some text in it. That works fine the problem is that when I try to read the file from within python nothing comes up and when I try to open the file once … | |
![]() | due to someone elses post about a keylogger, i wanted to use the program: [code=python] # get the character of a key pressed (no return key needed) # works only in the command window and with Windows OS # msvcrt.dll is the MS C library containing most standard C functions … |
Hello I've writing a application that is consists of a wxpython notebook and each page is a form to fill in, parcel query form, holiday form, product query form etc. Then there would be a button on each page to press that would create a simple text file that'd be … | |
I am sorry if it is simple or repetitive but I have problem with this. I make a play : I have python 2.6 or 3.0 a program in my c partition its name is test.py I want to compile it and it have to works in linux and windows. … | |
Sorry.. I am new to this forum. I tried to find solution from older threads but couldn't. Here I am starting a new thread. My doubt is that suppose i want to do one looping process to assign values, how I have to do. For example: Having one list like … | |
Hi All, I need one more help in string manipulation.. I am having a line as follows: [QUOTE] variable (x1|y1|z1)(x2||z2)(x3|y3|z3)[/QUOTE] From this I need to take values and store in lists like [QUOTE] xList = [x1, x2, x3] yList = [y1, 0, y3] zList = [z1, z2, z3][/QUOTE] Please help … | |
I have the following code working perfectly for basic authentication with http. I'm going to be changing the site, however, to https. Can anyone point me in the right direction here? [CODE] import urllib2 from matplotlib.dates import strpdate2num from matplotlib.mlab import load from pylab import figure, show import urllib theurl … | |
Hi, could anyone help me updating my pictures and texts. The first picture and text is okay but then the next just gets added in the same textarea instead of "refreshing the page" and adding the next "page" with a pic and text. I also get this error message. screen.delete(0.0, … | |
Hi attempting to make an address book program but hit a snag- I have: A class to give various attributes(phone numbers etc)to an instance which then puts it all into a doc string which can be added to a dictionary- but I want a function that will ask the user … ![]() | |
When I run this code: [code=python] import wx ID_FILE_QUIT = 101 class MainFrame(wx.Frame): def __init__(self, title): wx.Frame.__init__(self, None, wx.ID_ANY, title=title) self.menuBar = wx.MenuBar() self.fileMenu = wx.Menu() self.fileMenu.Append(1, '&Quit\tCtrl+Q') self.Bind(wx.EVT_MENU, self.Close(), id=ID_FILE_QUIT) self.menuBar.Append(self.fileMenu, '&File') self.SetMenuBar(self.menuBar) self.Show() app = wx.App() frame = MainFrame('Ya Mum') app.MainLoop() [/code] I get some error about expecting … | |
Hello, I have a certain way i want to do something but im not sure where to start, or if python can even do it. what i want is a way to display the current action during a large data conversion program.... I want it to look like an GUI … | |
Right, so I looked at some python tutorials about interfacing with internet, but every time a use a code such as: [code] import urllib pagetext = urllib.urlopen("http://www.python.org.html").read() print pagetext [/code] It just comes up with a load of error messages. how can i sort this | |
Hi, I have this code: list = ['12 angry men', 'Rash &# xf4;mon'] [CODE]def func(list): ... for e in list: ... e = re.sub(' ?&# x([0-9a-f]*);',r'\x\1',e) ... print type(e) ... e = unicode(e,'iso-8859-1') ... print type(e) ... print e[/CODE] I get this output: [CODE] 12 angry men Rash\xf4mon[/CODE] whereas I … | |
i've made a little animation using python and the pygame module, I'm just wondering if it's possible to turn that into a screensaver? is there a format i have to save it to? If anyone knows i would be grateful for the solution thanks, a1eio | |
I'm brand new to python (and programming) and trying to write a script that will download a .csv from the Internet and then allow me to plot data from the .csv. I already have the plot working, and I can grab the file locally, but I can't figure out how … | |
Dear friends, I have this code which attempts to get the last modified date of an http resource: [CODE]request = urllib2.Request('http://www.imdb.com') >>> opener = urllib2.build_opener() >>> request.headers {} >>> first = opener.open(request) >>> first.headers.dict {'transfer-encoding': 'chunked', 'set-cookie': 'session-id=209.251.138.146.1246519635845007; path=/; domain=.imdb.com, uu=bN4RO5T1YWqLBgRAupwcdgCRSyzj0j26pvJ+qYPCXqmT117Zs9L+/LfGO4zGx50bwJFtjNPSXuqj8g4pgDJ+meCRbaoGcS2aoNZb7PiBbbqjkm66I/I+qSAyfpnj8l7qA/I+qTAyfpngkW2KBnEtmqDXe20AkW26oLFtuqC3KyrjwW26o5IOuZOyLtnAgc0ZsLFtuqCRbergwR2Ko=;expires=Thu, 30 Dec 2037 00:00:00 GMT;path=/;domain=.imdb.com, cs=xOA2Pyx3xsSbt7wMU8ZOhAbGfbqgkW2NmIHl2qPyXuoj8j6pMDJ+meCRbYoGES2aoJFb/feFHbqjsg7/p9HNySCRWyxAGW26oKdbraCRbbqgsW26oJFt+uDBHYqg==;expires=Fri, 03 Jul 2009 … | |
How to acheive this in Python? [QUOTE]Converting the string "HelloPythonWorld" to "HELLO_PYTHON_WORLD"[/QUOTE] | |
Hi, This is the existing code: [CODE]for c in chartNames: chartUrl = baseChartUrl+c hd = extractChart(chartUrl) writeChart(hd,c) for key in hd: if key in chart: chart[key].append(c) else: chart[key] = [c] [/CODE] when i wanted to insert a line before [CODE]chartUrl = baseChartUrl+c[/CODE] by putting the cursor to the end of … | |
Hi everyone it's been almost a year since I gave up programing in python so I have forgotten a lot of things, so just bare with me. Ok so I was playing around with python and ended up with this little program. [code=python] def test(): number = input("Number: ") scale … | |
I am having a text file contaning the following: "int Function1 (int arg1, "0|1", char * arg2); int Function2 (int arg1, " ", char * prt1); ..." I need to open this file, split the each word and store it as global variable. I did this in Perl but now … | |
Hi, i wrote the socket script in python, Here both server and client running in under same machine. operating system is ubuntu 8.10 desktop version. [B]tcp server[/B] [CODE] 1 #!/usr/bin/env python 2 3 import socket 4 import sys 5 6 server_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) 7 server_socket.bind(("", 5000)) 8 server_socket.listen(5) 9 while … | |
Hello, I am new to Python. I am trying to start writing some simple programs in it. Which IDE would you suggest? I am currently using NeatBeans for my Java programs but i don't think i can use it for Python P.S. I am using Mac OS X 10.5.7 Thank … | |
I'm working on learning on programming with Pygame by following a tutorial linked from the Pygame site. I seem to have stuck myself in a hole, however, because I can't seem to set keys to do different things within the program. I'm trying to first close the program by pressing … |
The End.