Oh, so I was closer to being right than I thought.
Okay, so the code in my post above opened the file for you. In order to get something random, use the random module. Specifically, if you give random.choice(argList) a list as an argument, it'll give you back one of the element of the list at random. If you have a file object (like the one that the code in my above post gets you) then the readlines() method will return the lines for the text in order. You're code above for spliting the whole of the file at newlines (\n) does work, but you don't have the right syntax for it. Here's how I'd do it:
Also, how do you name variables according to other variables' values?
like lets say i do:
count = 0
count += 1
if count == 4:
number [count] = 2
up there I tried to name the variable number along with another variables value 1-4, but how do I do that? what if i name the variable numbercount and it doesnt ouput the name as number1 or number 2 but numbercount the whole time? are there some kind of varaible tags? like can i do this: number%count% = 2
For your second question, yes, there is a way to make arbitrary variable names in python, but you shouldn't need it. How familiar are you with lists and dictionaries? I would pull up a few online tutorials and go over them, as they should suit your needs. If for some reason they don't, look into eval(), as that's how you evaluate arbitrary code.
thanks for explaining that, but how do I specify which web browser to use out of that list? you didn't explain that.
Okay let me clarify. What I'm asking is, is there some kind of character in python that allows me to assign (for example) numbers 1-4 into a seperate variables name? like lets say i do:
for num in range(1,4):
#i want the 1-4 pick from the num var to be part of another
Entry[I]num[/I] #Entrynum isn't supposed to be called "Entrynum"
#but either Entry1, Entry2, Entry3, or Entry4.
#if i simply do Entrynum and set it to a var
#it stays as "Entrynum" and i dont want that
That is what I meant. How can I specify python to set the name of one variable according to a different one? Any 'tags' I can use for that? like:
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...