Halp

How do I create and assign thousands of variables in a while loop in python?

Other urls found in this thread:

docs.python.org/2/c-api/reflection.html
twitter.com/NSFWRedditVideo

>What's a list

I'm assigning lists to the variables ,genius.

>What's a list of lists

I'm assigning them to list of lists.

Go deeper then. List of lists of lists. The only limit is your RAM. Any time you're looking at var001 through var999, you're better off with an array.

You are doing something wrong.

docs.python.org/2/c-api/reflection.html

var1
var2
varX

Use reflection to create and init the variables. Using a loop is implied.

>How do I create and assign thousands of variables

You should probably think about your desing..

Id'd put it in a two-dimensional array:

myArray=[[i*j for j in range(10)] for i in range(10)]

for i in range(len(myArray)):
for j in range(len(myArray[i])):
print myArray[i][j]

If that's not possible you might think about using a differnt data structure (i.e. a list) and manage the lists in a meta data structure, as the other user has suggested.

guess you don't need any help then ,genius.

It's simple, just use spreadsheet program to generate the assignment statements and then copy/paste them into your python code file.

this

thats not how commas work

You shouldn't have to.
Tell us what exactly you want to do, and maybe we can tell you a better way of doing it

I'm designing a speechbot which fetches speeches and quotes from the internet and separates them word by word .it mixes speeches and brute forces combinations which makes sense.I know i'm doing something wrong but I want to do it anyway.

*Why* do you want to use crazy named variables rather than arrays?

its exactly how commas work, niggerface autist

no it,s not

Lol... why are you not just using a list of strings? If you need searching or other properties then use a hash with a custom data structure.

New averaging system, eh? You're doing something horribly wrong.

>55174406
I already have list of list of all the strings. How can create different string on the basis of appearance? i.e first word,second word...
I thought I should create variables each word and append them to a new list on the basis of their index.
Is there a better way? Sorry if I sound like a retard.

Anywhere you'd use a custom named variable, use an array with an index.

Instead of
output[i] = var123
do
output[i] = words[123]

Or
output = ""
...
output += words[123] + " "

Use a Map or a Dict.

fuck off,

Sick reference bro, your references are out of control.

>How do I create and assign thousands of variables in a while loop in python?

You don't because that's fucking retarded.

This thread is hilarious.

>using for loops in Python
senpai...

God and God spelled backwards?

what you need:
words = {}
word['gif'] = 'jif'
print(word['gif'])

what you want:
exec(' gif = "jif" ')
print(gif)

this
just use vectorization for literally all for loops

install gentoo