User Profile
Collapse
-
Python 2.0 and 2.4b1
I wrote a python script for a machine that uses python 2.0. Now I've testing that same script on a similar machine that uses python 2.4b1 but it isn't working. Are there any significant differences between the two versions? -
sure
[CODE=xml]
<servicing name="alignment ">
<!-- *************** *************** ****** BEGIN OF PASS *************** *************** ************ -->
<!-- TRJ-002448 Changed to prevent the carriage from going to the secondary spittoon during printhead alignment
plots. This happens because the printmode is a mix of uni-directional and bi-directional... -
-
when i run this script, it says "ImportErro r: No module named xml.dom.minidom "
Is there any other way to perform this function without using minidom?Leave a comment:
-
My python script looks like this
I get an error that says that return is outside function. I am using python 2.0.Code:import xml.dom.minidom from xml.dom.minidom import parse, parseString dom1 = parse('/home/test.xml') # parse an XML file by name elements = dom1.getElementsByTagName("servicing") return elements[0].attributes['name'].valueLeave a comment:
-
this is what the contents of the xml file looks like and I want to take the value of 'name' and return that to an external program.
Code:<servicing name="color-measure-print-and-scan">
Leave a comment:
-
I can use the code below to parse the file, but how can I extract a value of a tag such as 'name' with a value and return that value to an external program?
Code:from xml.dom.minidom import parse, parseString dom1 = parse('c:\\temp\\mydata.xml') # parse an XML file by nameLeave a comment:
-
Extracting a value from an xml file
Is there a way to use python to extract a value from an xml file? -
search to see if a file exists
Can someone help me with a python script that can see if a file exists and to return a number if does or doesn't? -
Can you add some comments to the code to help me get a better a better understanding of which sections do what?Leave a comment:
-
it helps a little more. Can you add some comments to the code to help me get a better a better understanding of which sections do what?Leave a comment:
-
-
As I said before, I am a noob at python and am trying to understand what is going on. I was wondering if you help me understand what a couple of the lines of the script are doing.
Code:lineList = [line.strip().split() for line in f.readlines()]
Leave a comment:
-
this script takes in numbers one at a time eventhough they are listed together. Is there a way that I can input an entire list, i.e. 0 1 2 3 4 5, from the command line and have the script zero them out? Kinda like the example:
Code:import sys names = sys.argv[1].split(', ') list = [] for name in names: list.append(name) print list #print "Hello " + sys.argv[1]Leave a comment:
-
-
How do I take in Command Line arguments?
Right now, I have this python script that lets me choose which column of a text file that I can zero out. Them column nubmer is stored as the variable 'elem'. I also was given a sample of taking in command line arguements. I was wondering if anyone could help me intergrate this into the code so that from the command line I can input a number and have the script zero out the column.
beginning text file:
#Number of Bits ... -
Help with some python 2.0 code
I need help to get this script to accept more than one number in the 'elem = ' line so that I will be able to zero more than one line at a time. Right now I am able to get it to do one line at a time. This script is written using python 2.0.
Here is what the text file looks like:
#Number of Bits
12
#Data
0 0 0 0 0 0 0 0 0 0 0 0
12 5 3 4 6 4 5 4 7 5 5 10
24 9 7 7 13 7 9 9 14... -
now that I can get the command line arguemet into the python script, can you help me get more than one variable into the 'elem=' lin to accept more than one number to zero out more than one columns?Leave a comment:
-
Help with command line arguements
I need help being able to pass a number from a command line into a script that zeroes out columns of a text file. Using python 2.0.
Here is what the text file looks like:
#Number of Bits
12
#Data
0 0 0 0 0 0 0 0 0 0 0 0
12 5 3 4 6 4 5 4 7 5 5 10
24 9 7 7 13 7 9 9 14 10 10 20
and this is what it does:
#Number of Bits
12
#Data
... -
can you help me make this take in a command line argument and have it loop the zero'ing out of the columns until all the numbers that were inputted through the command line.Leave a comment:
No activity results to display
Show More
Leave a comment: