15,185 Topics
| |
[CODE]info = '''<table> <tr align = "center"> <h1> Lachlan Osborn </h1> <p> Address: 5 Smith Street, Manly <br> Date of Birth: 26th April 1993 </p> <a href="semester.html"><b>My Semester Units</b></a> <p><b>Check out my <a href="hobbies.html">hobbies.</a></b></p> </tr> </center>''' def remove_html(text, info): import re text = re.sub(r'<.*?>', '', info) return text remove_html(text.strip())[/CODE] | |
I want this program to read a text file then target and replace anything start with < and end with > for example it finds <html>, replace that into **** but somehow i tested it and it didn't work than i expected. any suggestions? [CODE]def remove_html(text): txtLIST = list(text) i … | |
Alright so I was not sure exactly how to say this, but here is the idea. I have a graph or table I guess you could call that looks like this. [CODE] print ''' ----------------------------- | | | |x | | | |----------------------------- ''' [/CODE] Then I want to make … | |
Create a function that take a full name as a parameter and returns just the middle name regardless of how many words it consists of. | |
I'm running a command line app from a Python script: [CODE]os.system(myapp)[/CODE] myapp contains the path to the app and the required parameters. It works fine but it runs at, I believe, Normal priority which makes the PC sluggish. How can I start the external process at a lower priority? Thanks. | |
hi everyone i am very close to finishing my first program in python, but there are two things in the way. first of all the code highlighted in red reads the number of pages of pdf files in a directory. my problem is that it is in a for loop … | |
Ok some of you might've seen my post from yesterday about the weekend challenge game thing i'm doing with a friend. The link to my post yesterday is [url]http://www.daniweb.com/software-development/python/threads/416633/1777493#post1777493[/url] Anyway, now im trying to make a shop type thing but im having trouble writing a script (or whatever you call … | |
hi everyone i am currently building a program which logs into an email, extracts information like the date, sender, subject, number of copies, and takes any attachments and puts them into a directory, than takes the number of pages of the pdf. i have already built a program which does … | |
Hello all, I am new to python and working on a school project to import an SQL query with python and have it print out results then save them to a file location. This is what I have so far and wanted to know what I am missing or if … | |
So this program is supposed to take a letter the user wants to replace, and store that in a dictionary. At the end, it asks the user to enter a message and it's supposed to decode it, cross-referencing the dictionary and replacing any letters within it to the newly assigned … | |
I need to write a script that will check a file and find out what type of file it is. The files I am downloading none of them have extensions and some are binary others txt and html files. I only want to work with the binary files. If anyone … | |
Hey guys, I've looked over several Google results for basic explanations on [CODE]is / '=='[/CODE] However, I don't think I quite understand enough to know what is the ideal operator for this. [CODE]mylist=[1,2,3] if type(mylist) == list: print 'yes'[/CODE] or do I use [CODE] if type(mylise) is list: print 'yes'[/CODE] … | |
Hi guys, still Noob here, so i apologize for not using the correct terminology. I will be as detailed and accurate as possible! I've been using QT Designer, and been trying to figure out how to "combine" the GUI ive created with the python script I wrote before making a … | |
Hello, I'm new to python and have a requirement to decompress various NRV2B compressed files. I have the python functions for performing this decompression, however I am unsure how to get it working. I have tried making this a module, importing it and then feeding my compressed files as a … | |
Ok so me and my friend are doing a weekend challenge... Whoever makes the best game wins. Im trying to make a game like farmville but its called mineville and its just a little different. My problem is that theres this part in the code that keeps repeating, and i … | |
When I run my python scripts I generally run with the console open just to keep an eye on things. I have a script that calls 3 external command line apps one after the other. On one pc all output from these apps appears in the console window and is … | |
hi. i am trying to use two turtles in separate windows simultaneously in python but nothing found yet. i have tried multithreadding but still the same. can somebody help me please. thanks. | |
I have never taken a programing class before but my instuctor wants me to write a program in python i've been looking in the book and still don't even know where to start please any help would be great here's the program she wants You are helping your friend throw … | |
can anyone explain tkinter in object oriented style where you would have it in a class ? | |
how would you write this function in non oop [CODE] def highlight(self, seq): if "highlight" in self.textWidget.tag_names(): self.textWidget.tag_delete("highlight") i = len(seq) idx = "1.0" while True: idx = self.textWidget.search(seq, idx, nocase=1, stopindex='end') if idx: idx2 = self.textWidget.index("%s+%dc" % (idx, i)) self.textWidget.tag_add("highlight", idx, idx2) self.textWidget.tag_config("highlight", background="yellow") idx = idx2 else: return … | |
Hi , i have a dump file . i want to load it into a dictionary. i am using pickle load to load it as shown below: pkl_file = open( r'D:\work\dumpfile.dat', 'rb+') FinalTable = {} FinalTable = pickle.load(pkl_file) The problem is it is loading only one key and value from … | |
I'm am trying to make just a simple text-based adventure game, inspired greatly by Zork. Basically all it is is an IF statement for many possible input so the player isn't constrained to inputting their text in a certain format. Then each section is it's own module so when the … | |
So im stuck writing a function and was hoping someone would be nice enough to help. My objective is to look at a list of grades such as: [CODE][23 , 64 ,74 , 53 , 55[/CODE] And return a list with the number of grades in each percentage range I.E. … | |
Hey guys, In prepping for a job interview, I'm trying to eliminate some bad habits and this trivial problem has me realizing how hard that is :'(. The problem: Print a 12 x 12 multiplication table. This is easy.... [CODE]outstring='' for i in range(1,13): for j in range(1,13): outstring +='\t'+str(i*j) … | |
I have a list: [CODE][a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p][/CODE] I would like 4 lists: [CODE][a, e, i, m] [b, f, j, n] [c, g, k, o] [d, h, l, p][/CODE] How would I go about this? Thanks. | |
I've followed a tutorial where a Person class was used to illustrate the difference between class and instance variables. Something like: [CODE] class Person(object): population=0 def __init__(self, name): self.name=name Person.population += 1 print 'current population', Person.population Sally=Person('sally') Joe=Person('joe') [/CODE] This example really illustrated the difference between class and instance variables … | |
hi friends . i have a sqlite program. i need get stuff data from QLineEdit and add to model & tableView . but i dont know what should I do :( plz help me | |
Sometimes, before optimizing your code, you may end up to have very slow running code in list comprehension statement. Because you have not yet tested the code fully, it easy to loose patience and just interrupt the code. If you are making function, you can insert print statements for verification. … | |
The objective is to have the user guess the letters of a word which has to be the name of an object that can be seen. The user is presented with an array of 26 buttons corresponding to the 26 letters of the alphabet. Additionally the user is presented with … | |
Hi friends, I want create a image Button by hovering mouse event as a pushbutton,how i to do? |
The End.