LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 09-14-2001, 10:13 PM   #1
Colonel Panic
Member
 
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"
else:
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*****
 
  


Reply


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


All times are GMT -5. The time now is 11:50 AM.

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