14,946 Topics
|
|
I am reading in a string from a file which has the format $ 235.0 M. I need to convert this to a number and save the letter M somewhere else. Any pointers on how to strip off the $ and M? Thank you. |
|
Hi I need to remove characters such as ?.'"[] from a text file and replace it with a white space " " the file i need this done to is called mispel.txt i have also split the file into words and lowercase so far this what i have but last … |
|
Hello, Pls can somebody help me with time comparison between 2 scripts. I have already looked the documentation but I haven't found anything. I deal with following exercise: "Run this version of fibonacci and the original with a range of parameters and compare their run times." I intend to measure … |
|
Hey , Have a task i want to do I have a .txt file with mispelt words and a .txt file which is a dictionary and has correct spelling of words now i know that i need to split both of the .txt files into words , i need to … |
|
As part of a program I'm making, I have a class, and have 5 different instances of this class declared globally for accessing by anywhere else in the program. The class has a list associated with it, that should be different for each of the 5 instances of the classes. … |
|
|
i have this code but this only prints the line number in the incorrect word *text1*. however i want it to print the line number of the incorrect word located in the text file called words. what can i add to it or arrange? # text1 is my incorrectwords # … |
hi I'm new user of PYTHON and I want extract a little part into a string like this example 100|1999|pepito|False|[B]27-10655374-1[/B]|False|||05/09/1952|1|4||3||1|1|8|67||4|False|True|False|oerirabtaa||||Femenino|0|0|0|0|0|0|2| the part to extract (in the example, in black letter), have two parameters 1 is the part with exclusive format ##-########-# 2 ever is locate between 4º and 5º | … |
|
In python I have a very large string of 0s and 1s. i.e '010100100101110101001...' etc. I want to convert this to BINARY without first converting it to decimal. Then I want to take the resulting binary number and convert it to it's decimal equivalent. Fastest way possible because it is … |
|
i wanna check a zip file in a directory.how can do it? directory="c:\myzipfiles" listfiles="a.zip,b.zip,c.txt,d.xls" #a.zip is badfile import os import zipfile mylist=os.listdir("c:\myzipfiles") for zfile in mylist if zipfile.ZipFile.test(zfile): print"you can extract ",zfile else: print "you cant extract ",zfile and how can i use zipfile.ZipFile.testzip() thanks for answers... |
|
|
Hello! I've got this collection of python files in a directory. Each file contains a variable called 'ors' that has as its value a dictionary. I know you can get the value of the variable in a file by typing: >>> import filename >>> filename.variable What I'd like to do … |
Hi people I need help solving the following problems. Any help will be greatly appreciated: 1. Create a simple python application that displays a list of movie titles that match a set of terms, which is given in a text file called "input.txt". The content input.txt must be: Harry Potter … |
|
|
i currently have this piece of code i need to create a dictionary that prints the incorrect word and the line number where it is incorrect. words [] # is my txt file text1 [] # is my list of incorrect words i am new to programming and dont know … |
I need this program to buy and sell items from a list. the list needs to display similar to below and have a menu for user to select options from: ID No. Name Price Stock 1 Apples $2.50 4 Choice: Buy - 1 Sell - 2 Quit - 0 *Needs … |
|
Hi there I have following XML document that i want to read in python code. i know how to read, thing is i want to make hash/list from this XML document. <?xml version="1.0" ?> ‐<TradeExt> ‐ <fxall category="buyer" version="2.0"> ‐<tradeHeader> <sourceId>test_sourceId1</sourceId> <pmsId>4521363.0.0</pmsId> <fundId>ACCT1@TESTCUST</fundId> </tradeHeader> ‐ <tradeStatus> <dealImmediately>F</dealImmediately> <blockImmediately>F</blockImmediately> </tradeStatus> ‐ … |
|
I'm trying to write a script that will go to a host and list all of its shares. So far, in my searching, it seems that I need to include a top level share name. For example: [CODE]os.listdir('\\\\1.2.3.4\')[/CODE] doesn't seem to work, but [CODE]os.listdir('\\\\1.2.3.4\\share\')[/CODE] will work. As a bit of … |
|
Lets say I have a class. It holds other classes in it. ex [CODE]class Test: def__init__(self, name): self.name = name def getname(self): print(self.name) class Holder: def __init__(self, tests): self.tests = tests def getnames(self): for i in self.tests: print( i.getname())[/CODE] so lets say I pickle an instance of Holder with 3 … |
|
how do I save a dictionary, (below), to a txt file thats is in a tabular format? i also need to be able to rload the txt file back into its dictionary form... catalog = { 1:["Bread", 1.50, 10 ], 2:["Cheese", 5.00, 5], 3:["Apples", 2.50,12] } eg. 1 Bread 1.50 … |
|
Can someone please show me how to implement the pickle module in this pogram!? PLS? I've tried for hours but I think programs are immune to my trying! Thnx [CODE]'''maintain a catalog''' def main(): global catalog loadCatalog() while True: pick = showMenu() if pick == 0: break elif pick == … |
|
python is not a new programming language ,it has been there for the last .... 15+ years or so ? right ? now , by having a look at this page [url]http://wiki.python.org/moin/Applications[/url] i can see only few programs written in python .i tried some of the programs in that list … |
|
I have this wx.ListCtrl and I want to get the "Variable" name and the "Value" name, but I can only get the "Variable" name, how to get the second? [code=python]def __init__(...): ... self.list_ctrl_1.InsertColumn(0, 'Variable') self.list_ctrl_1.InsertColumn(1, 'Value') self.list_ctrl_1.SetColumnWidth(0, 200) self.list_ctrl_1.SetColumnWidth(1, 200) for item in ls: self.list_ctrl_1.Append((item[0],item[1])) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.dclick) def dclick(self, event): … |
|
Hi all, I need to initialize an array iteratively. For example array my_arryay needs to initialized with 512 characters and next with 1024 characters and next with 2048 characters etc etc, which can only be iteratively. Something as in C: for( i = 0; i<100:i++) { my_array[i] = 'a'; } … |
|
Hi all, I have got several python scripts and I need to run them in one shot. So I assume that in a .py file I can give statements ./file1.py ./file2.py ./file3.py etc to run multiple scripts. I am defining global variables in a config.py file and these will be … |
|
Hi all, I have got several python scripts and I need to run them in one shot. So I assume that in a .py file I can give statements ./file1.py ./file2.py ./file3.py etc to run multiple scripts. I am defining global variables in a config.py file and these will be … |
|
So, I am learning Python. To help my understanding, I was wondering how someone might make this code more efficient. Purpose: Take a 32-bit value (tempCode) and output each nibble. My way was to use a string, basically shifting out the binary value from bit 0 to bit 31 into … |
|
There is a table that I need to access using pyodbc that contains numeric descriptions for some of the columns and I cant seem to figure out how to get to them by name. for example, this works great for pulling the column called 'Category' [code=python] cursor.execute("exec blablabla") for row … |
|
Hello I made a program that submits a paragraph to a webpage, using mechanize. Its all working great, except when I view the paragraph, all the newlines have disappeared and it makes all the paragraphs all block up together into one long sentence. But when I open up the page … |
|
|
|
heya guys - new to posting here, but i have browsed the forums for help over this year so far. obvisoulsy im also new to python, only trying it since march. Im trying to write some code for a 'knock knock' program. It uses a txt file for the jokes, … |
|
Not really sure what a command line argument is, but here is an example question that I don't understand: "Write a program that gets 4 integers as command-line arguments, prints the values and their total." Can somebody show me how to do this? I have like 10 of these to … |
|
I was able to finish some: [CODE]def sieve( n, primes): numbers =[] # make a list of integers from 0 to n, inclusive for i in range(2, n+1): numbers.append( i ) # by definition, the first prime is 2 del(numbers[ _____________ ]) del(numbers[ _____________ ]) # while there are still … |
The End.