Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-14-2001, 10:13 PM   #1
Colonel Panic
Registered: Jul 2001
Location: California
Distribution: Red Hat 7.1, Slackware 8.0
Posts: 216

Rep: Reputation: 30
Using letters/strings to assign variables in python

I am working on a little project, a dictionary, and I'm using python to do it. I'd like to assign variables to every word (lots of elif statements in there ), but whenever I try to assign a variable with a letter/string, I get an error. Example:

word = input("Word to look up --> ")
if word = "foo":
print "A jargonish term used to define anything unknown. Example: I don't know who made Eric's printer. It's a foocorp. Foo being the unknown"
print "Word not yet added..."

#(The defination is something that I said, not the truth)

You can tell that I'm a novice coder, BUT I'm learning, so go easy on me, and don't flame it, or I'll give you a swift kick in the shin, so nyah!

Anyway, that's where the error would come in. Maybe it has trouble with the "foo" part of it; I really don't know. Thanks in advance!

*****Colonel Panic*****


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to find duplicate strings in vertical column of strings markhod Programming 7 11-02-2005 04:04 AM
python cant assign to literal master Programming 4 09-05-2004 04:36 PM
C++ converting strings to variables dhbiker Programming 9 05-31-2004 04:06 AM
bizarre python behavior - simple cgi variables SerfurJ Programming 2 04-14-2004 02:58 PM
Shel scripting: variables pointing to variables and case Dark_Helmet Programming 5 06-08-2003 11:07 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:31 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration