User Profile
Collapse
-
Yes, that is exactly what I was looking for. Thank you much!! -
Create variable for each iteration of a for loop
Hello, I am using a for loop to iterate through an array and need to assign each iteration to a new variable, such as
but instead of printing i, I want the for lopp to assign each iteration to a unique variable, so that when the for loop completesCode:arr = ['bread', 'milk', 'cheese'] for i in arr: print i
...Code:var1 = 'bread' var2 = 'milk' var3 = 'cheese'
-
How to listen to serial port
Hello,
I need to write a script to listen to a serial port basically forever. The python script will be launched by another program and the input to the com port passed to the other program. As long as this other program is running, I need the python script to run and handle the com port traffic.
I have this working (thats about it),
...Code:import serial from scala5 import sharedvars import
-
Thanks for pointing me this way, I am very new to this and never would have thought of it. Had to to change toto get the tag name completely out of the dom element. Thanks again!Code:print child.toxml
Leave a comment:
-
Extracting XML Tag Names
Hello, I need to get the tag name from an XML file. I know where it is going to be everytime, but I do not know what the name will be. This is a snippet of my xml data.
...Code:<Forecast> <Config/> <Date>THU SEP 9 2010</Date> <Time>4:53 PM CDT</Time> <Thursday> <Conditions>Partly Cloudy</Conditions> <Description>Partly cloudy</Description>
-
-
How can time be compared
Hello,
I am writing a script that is going to download and read XML data from a server. The server updates the xml data every 4 hours. Instead of downloading a new copy of the xml everytime the script runs, I want to look at the timestamp of the local file to see if it is less than 4 hours old. If it is, I will read the local copy, but if not I will download a new copy and read it. I can't seem to find any good way of doing this.... -
-
cancellable timed loop
I am very new to python and programming in general and am trying to build a loop that can be cancelled when the timer ends or cancelled by a variable that will be set externally. I am testing with my code below and it doesn't want to cancel, like it never re-reads the variable to realize that it is no longer a 1. It seems like I am either really close or way off.
...Code:import threading scalavar = 1 enable = 1 def disable():
No activity results to display
Show More
Leave a comment: